List of usage examples for javax.jms BytesMessage getJMSCorrelationID
String getJMSCorrelationID() throws JMSException;
From source file:com.bitsofproof.supernode.core.ImplementBCSAPI.java
private void addBloomFilterListener() throws JMSException { addMessageListener("filterRequest", new MessageListener() { @Override// www .j a va2s . c om public void onMessage(Message msg) { BytesMessage o = (BytesMessage) msg; byte[] body; try { body = new byte[(int) o.getBodyLength()]; o.readBytes(body); BCSAPIMessage.FilterRequest request = BCSAPIMessage.FilterRequest.parseFrom(body); byte[] data = request.getFilter().toByteArray(); long hashFunctions = request.getHashFunctions(); long tweak = request.getTweak(); UpdateMode updateMode = UpdateMode.values()[request.getMode()]; BloomFilter filter = new BloomFilter(data, hashFunctions, tweak, updateMode); synchronized (correlationBloomFilter) { if (!correlationProducer.containsKey(o.getJMSCorrelationID())) { MessageProducer producer = session.createProducer(msg.getJMSReplyTo()); correlationProducer.put(o.getJMSCorrelationID(), producer); } correlationBloomFilter.put(o.getJMSCorrelationID(), filter); } } catch (JMSException e) { log.error("invalid filter request", e); } catch (InvalidProtocolBufferException e) { log.error("invalid filter request", e); } } }); }