Announcement Announcement Module
No announcement yet.
Why does a queue need a "static" listener Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why does a queue need a "static" listener

    Hi again!

    Sry for spaming with questions here, but I am a bit overloaded by work and risk my job

    The question:
    For some reason when defining the queues, listeners and containers in the spring config file for a jms, at the pont of defining the container I HAVE to set a messageListener.
    But in my case the listeners to the (reply) queue are not "static", meaning that different threads (web requests actually) need to register as listeners dynamically.

    So in my code, the object which has to wait for the reply of the worker there is something like this (I need to block until the answer arrives):

    protected WidgetWorker waitForWorker(String waitKey)
    OutsourceTask task = (OutsourceTask)jmsTemplateReceiver.receiveSelected AndConvert(getWaitQuery(waitKey));
    return (task.getWorker());


    But in my spring config (follows) I have to set a listener and the reply thats created by the object that works on the (jms) requests is sent to that object instead and this "waitForWorker" thing does not receive a thing.
    When Spring checks the configuration before startup when using the following bean configs it tells me that I have to set a listener in the container.

    <bean id="replyForwarder" class="webnwalk.service.util.jms.ReplyForwarder">
    <property name="jmsTemplateReplyQueue" ref="jmsTemplateReceiver"/>

    <bean id="widgetWorkerReplyListener" class="org.springframework.jms.listener.adapter.Me ssageListenerAdapter">
    <property name="delegate" ref="replyForwarder"/>
    <property name="defaultListenerMethod" value="taskFinished"/>

    <bean id="containerClient" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <!-- Why do I have to set this?:
    <property name="messageListener" ref="widgetWorkerReplyListener"/> -->
    <property name="destination" ref="widgetWorkerReplyQueue"/>

    I really dont understand that principle. Why cant I just set up the reply queue and then programatically (dynamically) register the listener??

    Thanks again!

  • #2
    Hey guys, sorry, mistake was on my side, I dont even need any of the reply-queue stuff (apart from its own single definition, but not the listener and container) if I have a response destination..

    Thanks though, feel free to delete my posts...