/** * Creates a new consumer connection context, reusing any existing connection that might have already been created. * The destination of the connection's session will be that of the given endpoint. * * @param endpoint where the consumer will listen for messages * @return the new consumer connection context fully populated * @throws JMSException any error */ public ConsumerConnectionContext createConsumerConnectionContext(Endpoint endpoint) throws JMSException { return createConsumerConnectionContext(endpoint, null); }
/** * Creates a new consumer connection context, reusing any existing connection that might have already been created. * The destination of the connection's session will be that of the given endpoint. * * @param endpoint where the consumer will listen for messages * @return the new consumer connection context fully populated * @throws JMSException any error */ public ConsumerConnectionContext createConsumerConnectionContext(Endpoint endpoint) throws JMSException { return createConsumerConnectionContext(endpoint, null); }
@Override public ConsumerConnectionContext getConsumerConnectionContext() { ConsumerConnectionContext ctx = null; try { // here we build a faux consumer connection context whose data will be duplicated in // a producer connection context so the response message can be sent. The endpoint we // use here is just a dummy one - it will be replaced with the JMS ReplyTo by the superclass. ConnectionContextFactory ccf = new ConnectionContextFactory(getConnectionFactory()); ctx = ccf.createConsumerConnectionContext(Endpoint.TEMPORARY_QUEUE); } catch (Exception e) { log.error("Failed to build context - will not be able to respond to message", e); } return ctx; } }