I am not using jndi, just spring, and developing a jms framework that has to also connect with flex's message service for async handling. I'm passing dynamic dest names and possibly a pub sub type to resolve to a jms Destination. The second wraps a dynamic destination created in the callback
Code:
public Destination resolveJmsDestination(String dest, boolean pubSubDomain) throws JMSException {
return getJmsTemplate().getDestinationResolver().resolveDestinationName(createSession(), dest, pubSubDomain);
}
Code:
public Message createAndReceive(final String dest, final String selector, final boolean pubSubDomain) {
return (Message) getJmsTemplate().execute(new ProducerCallback() {
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
Destination d = getJmsTemplate().getDestinationResolver().resolveDestinationName(session, dest, pubSubDomain);
return session.createConsumer(d, selector).receive();
}
});
}