@Override public MessageProducer createProducer(Destination destination) throws JMSException { if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); } return next.createProducer(destination); }
given(session.createProducer(destination)).willReturn(messageProducer);
@Override public MessageProducer createProducer(Destination destination) throws JMSException { if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); } return next.createProducer(destination); }
@Override public MessageProducer createProducer(Destination destination) throws JMSException { if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); } return next.createProducer(destination); }
@Override public MessageProducer createProducer(Destination destination) throws JMSException { if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); } return next.createProducer(destination); }
/** * @param destination * @return * @throws JMSException */ public MessageProducer createProducer(Destination destination) throws JMSException { if (destination instanceof Topic) { throw new InvalidDestinationException("Topics are not supported by a QueueSession"); } return next.createProducer(destination); }
public void messageReceived(QueueSession session, Object message, Destination destination, String selector) throws Exception { String name = ""; if (destination instanceof Queue) { name = ((Queue) destination).getQueueName(); } else if (destination instanceof Topic) { name = ((Topic) destination).getTopicName(); } MessageProducer producer = (MessageProducer) this.producers.get(name); if (producer == null) { producer = session.createProducer(destination); this.producers.put(name, producer); } this.handler.messageReceived(new JMSSessionWriter(session, producer, selector), message); } }
this.taskServerQueue = this.producerSession.createQueue(taskServerQueueName); this.responseQueue = this.consumerSession.createQueue(responseQueueName); this.producer = this.producerSession.createProducer(this.taskServerQueue); this.connection.start(); return true;
private void loggingThroughJMS(OAuth2AuditLog oAuth2AuditLog) { QueueConnection connection = null; try { connection = pooledConnectionFactory.createQueueConnection(); connection.start(); QueueSession session = connection.createQueueSession(transacted, ACK_MODE); MessageProducer producer = session.createProducer(session.createQueue(CLIENT_QUEUE_NAME)); TextMessage txtMessage = session.createTextMessage(); txtMessage.setText(ServerUtil.asPrettyJson(oAuth2AuditLog)); producer.send(txtMessage); } catch (JMSException e) { log.error("Can't send message", e); } catch (IOException e) { log.error("Can't serialize the audit log", e); } catch (Exception e) { log.error("Can't send message, please check your activeMQ configuration.", e); } finally { if (connection == null) return; try { connection.close(); } catch (JMSException e) { log.error("Can't close connection."); } } }
MessageProducer producer = sess.createProducer(queue); producer.send(sess.createTextMessage("TEST"));