org.apache.qpid.client.AMQAnyDestination Java Examples
The following examples show how to use
org.apache.qpid.client.AMQAnyDestination.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JbootQpidmqImpl.java From jboot with Apache License 2.0 | 6 votes |
public void sendMsg(String addr, Object message) { try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = new AMQAnyDestination(addr.toString()); MessageProducer producer = session.createProducer(destination); producer.setTimeToLive(30000); Message m = null; if (!serializerEnable) { m = session.createTextMessage((String) message); } else { byte[] data = getSerializer().serialize(message); m = session.createBytesMessage(); m.setIntProperty("data-len", data.length); ((BytesMessage) m).writeBytes(data); } producer.send(m); } catch (Exception e) { LOG.error(e.toString(), e); } }
Example #2
Source File: JbootQpidmqImpl.java From jboot with Apache License 2.0 | 6 votes |
private void startReceiveMsgThread() throws Exception { if (ArrayUtil.isNullOrEmpty(this.channels)) { return; } for (String channel : this.channels) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String queueAddr = getQueueAddr(channel); Destination queue = new AMQAnyDestination(queueAddr); MessageConsumer queueConsumer = session.createConsumer(queue); new Thread(new ReceiveMsgThread(queueConsumer, channel, serializerEnable)).start(); String topicAddr = getTopicAddr(channel); Destination topic = new AMQAnyDestination(topicAddr); MessageConsumer topicConsumer = session.createConsumer(topic); new Thread(new ReceiveMsgThread(topicConsumer, channel, serializerEnable)).start(); } }