Announcement Announcement Module
No announcement yet.
Declarative JMS Destinations without JNDI? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Declarative JMS Destinations without JNDI?

    I'm building a sample application to demonstrate Spring's JMS integration and MDPs. When JNDI is available I can declaratively define the queues via:

    <jee:jndi-lookup id="queue" jndi-name="MyQueue" environment-ref="jndiProperties"/>

    When I don't have JNDI, however, I have to drop down into the code and programatically create the Destination instances:

    final Connection connection = ...
    final Session session = connection.createSession(...);
    final Destination queue = destinationResolver.resolveDestinationName(session ,...);

    Of course, with this path I have to implement my own connection and session caching and clean everything up when the application terminates.

    Have I overlooked some factory object that would let me do this?

    <bean id="queue" class="...SomeFactory">
    <property name="destinationName" value="Q1" />
    <property name="destinationResolver" ref="destinationResolver" />

    If not, I have a solution implementation that I would be glad to submit should anyone be interested.