Attached is a small sample test case. I see you have already resolved
CAMEL-2456 which was written for the exception when trying to send to a
temporary queue. Does this also solve the problem in this test case where
the message is sent to the wrong temporary queue?
Here is what the test does:
1. A client creates a temporary queue and registers a MessageListener for
it. The client sends a message to the queue "test.queue" with the temporary
queue set as the JMSReplyTo:
07:06:13,109 INFO Test - client created temporary queue
ID:core2-34974-1266066372002-2:1:1
2. The server receives the message from the client:
07:06:13,154 INFO Test - TestServer.handleMessage jmsReplyTo =
temp-queue://ID:core2-34974-1266066372002-2:1:1 body = request
3. The server uses a producer template to try to send a response back to the
client on the temporary queue. Here the InvalidMetadataException happens:
07:06:13,154 INFO Test - calling producerTemplate.sendBody,
tempQueueEndpointName =
activemq:temp:queue:ID:core2-34974-1266066372002-2:1:1
07:06:13,316 WARN DefaultManagementLifecycleStrategy - Could not register
Endpoint MBean for uri:
activemq://temp:queue:ID:core2-34974-1266066372002-2:1:1
org.springframework.jmx.export.metadata.InvalidMetadataException: No
ManagedResource attribute found for class: class
org.apache.camel.component.jms.JmsTemporaryQueueEndpoint
4. From the debug camel logging, camel decides to send the response message
to a DIFFERENT temporary queue than what the server specified in the call to
sendBody. Notice the original temporary queue name ends in 2:1:1, the new
temporary queue ends in 2:2:1.
Also notice the client never receives the response message. This is because
it was sent to the wrong temporary queue. If you run JConsole at this
point, you will notice there are 2 temporary queues: the original one
created by the client ending in 2:1:1, and a new one created by camel ending
in 2:2:1. The response message from the server was sent to the new
temporary queue created by camel.
07:06:13,356 DEBUG JmsConfiguration$CamelJmsTemplate - Sending JMS message
to: temp-queue://ID:core2-34974-1266066372002-2:2:1 with message:
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
null, originalDestination = null, originalTransactionId = null, producerId =
null, destination = null, transactionId = null, expiration = 0, timestamp =
0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
replyTo = null, persistent = false, type = null, priority = 0, groupID =
null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties =
false, readOnlyBody = false, droppable = false, text = response}
Claus Ibsen-2 wrote:
>
> Hi
>
> Create a small sample of your project and attached it to a JIRA ticket.
> Then we can take a look at it.
>
>
> On Wed, Feb 10, 2010 at 4:27 PM, ariekenb <[email protected]>
> wrote:
>>
>> I turned on DEBUG for org.apache.camel.component.jms.
>>
>> Here is what I see when I send to the temporary queue.
>>
>> My client is listening on the temporary queue named
>> ID:mwgk-36105-1265815399399-0:0:1 and you can see from my logging this is
>> the name I pass to ProducerTemplate.sendBody.
>>
>> However from the jms component logging, it actually sends to a different
>> temporary queue named temp-queue://ID:mwgk-33195-1265814473274-2:11:1.
>>
>> I can see from JConsole that the EnqueueCount on
>> ID:mwgk-33195-1265814473274-2:11:1 does get incremented. But my
>> subscriber
>> is not getting any message because camel is sending to a new temporary
>> queue.
>>
>>
>> 09:23:19,661 | INFO | tenerContainer-1 | SDSSFlightPublisher
>> |
>> face.service.SDSSFlightPublisher 154 | sending to endpointName =
>> 'activemq:temp:queue:ID:mwgk-36105-1265815399399-0:0:1'
>> 09:23:19,739 | WARN | tenerContainer-1 |
>> faultManagementLifecycleStrategy |
>> faultManagementLifecycleStrategy 187 | Could not register Endpoint MBean
>> for uri: activemq://temp:queue:ID:mwgk-36105-1265815399399-0:0:1
>> org.springframework.jmx.export.metadata.InvalidMetadataException: No
>> ManagedResource attribute found for class: class
>> org.apache.camel.component.jms.JmsTemporaryQueueEndpoint
>> at
>> org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler.populateMBeanDescriptor(MetadataMBeanInfoAssembler.java:279)
>> at
>> org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler.getMBeanInfo(AbstractMBeanInfoAssembler.java:69)
>> at
>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:202)
>> at
>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:193)
>> at
>> org.apache.camel.management.ManagedManagementStrategy.manageNamedObject(ManagedManagementStrategy.java:69)
>> at
>> org.apache.camel.management.ManagedManagementStrategy.manageObject(ManagedManagementStrategy.java:62)
>> at
>> org.apache.camel.management.DefaultManagementLifecycleStrategy.onEndpointAdd(DefaultManagementLifecycleStrategy.java:185)
>> at
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)
>> at
>> org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:402)
>> at
>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:116)
>> at
>> com.lmco.irad.tfdm.sdssinterface.service.SDSSFlightPublisher.publishNotificationToOneSubscriber(SDSSFlightPublisher.java:155)
>> at
>> com.lmco.irad.tfdm.sdssinterface.service.SDSSFlightManager.reconstituteSubscriberID(SDSSFlightManager.java:128)
>> at
>> com.lmco.irad.tfdm.sdssinterface.service.SDSSSubscriptionHandler.processSubscriptionRequest(SDSSSubscriptionHandler.java:59)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:195)
>> at
>> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:115)
>> at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:117)
>> at
>> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:83)
>> at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
>> at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
>> at
>> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
>> at
>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
>> at
>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
>> at
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
>> at
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
>> at
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
>> at java.lang.Thread.run(Thread.java:619)
>> 09:23:19,747 | DEBUG | tenerContainer-1 | JmsProducer
>> |
>> pache.camel.impl.DefaultProducer 66 | Starting producer:
>> Producer[activemq://temp:queue:ID:mwgk-36105-1265815399399-0:0:1]
>> 09:23:19,770 | DEBUG | tenerContainer-1 |
>> msConfiguration$CamelJmsTemplate |
>> ngframework.jms.core.JmsTemplate 469 | Executing callback on JMS
>> Session:
>> PooledSession { ActiveMQSession
>> {id=ID:mwgk-33195-1265814473274-2:11:1,started=false} }
>> 09:23:19,784 | DEBUG | tenerContainer-1 |
>> msConfiguration$CamelJmsTemplate |
>> msConfiguration$CamelJmsTemplate 280 | Sending JMS message to:
>> temp-queue://ID:mwgk-33195-1265814473274-2:11:1 with message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> null, originalDestination = null, originalTransactionId = null,
>> producerId =
>> null, destination = null, transactionId = null, expiration = 0, timestamp
>> =
>> 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId =
>> null,
>> replyTo = null, persistent = false, type = null, priority = 0, groupID =
>> null, groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> = null, content = org.apache.activemq.util.byteseque...@1ce2a846,
>> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
>> size = 0, properties = null, readOnlyProperties = false, readOnlyBody =
>> false, droppable = false}
>>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Camel logs before it send the JMS message
>>>
>>> if (logger.isDebugEnabled()) {
>>> logger.debug("Sending JMS message to: " +
>>> producer.getDestination() + " with message: " + message);
>>> }
>>>
>>> So if you enable DEBUG logging for org.apache.camel.component.jms you
>>> should see that log line
>>>
>>>
>>>
>>> On Wed, Feb 10, 2010 at 3:36 PM, ariekenb <[email protected]>
>>> wrote:
>>>>
>>>> Claus -
>>>>
>>>> The exception is logged as WARN. No exception is thrown out of the
>>>> ProducerTemplate.sendBody call however.
>>>>
>>>> More importantly, no message is ever actually sent to the
>>>> TemporaryQueue.
>>>> The client listening to the TemporaryQueue does not receive any
>>>> message,
>>>> and
>>>> JConsole shows the EnqueueCount for the TemporaryQueue remains at 0.
>>>>
>>>> Here is a more complete stack trace showing the error message and log
>>>> level:
>>>>
>>>> 08:30:43,389 | WARN | tenerContainer-1 |
>>>> faultManagementLifecycleStrategy |
>>>> faultManagementLifecycleStrategy 187 | Could not register Endpoint
>>>> MBean
>>>> for uri: activemq://temp:queue:ID:mwgk-45812-1265812243018-0:0:1
>>>> org.springframework.jmx.export.metadata.InvalidMetadataException: No
>>>> ManagedResource attribute found for class: class
>>>> org.apache.camel.component.jms.JmsTemporaryQueueEndpoint
>>>> at
>>>> org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler.populateMBeanDescriptor(MetadataMBeanInfoAssembler.java:279)
>>>> at
>>>> org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler.getMBeanInfo(AbstractMBeanInfoAssembler.java:69)
>>>> at
>>>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:202)
>>>> at
>>>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:193)
>>>> at
>>>> org.apache.camel.management.ManagedManagementStrategy.manageNamedObject(ManagedManagementStrategy.java:69)
>>>> at
>>>> org.apache.camel.management.ManagedManagementStrategy.manageObject(ManagedManagementStrategy.java:62)
>>>> at
>>>> org.apache.camel.management.DefaultManagementLifecycleStrategy.onEndpointAdd(DefaultManagementLifecycleStrategy.java:185)
>>>> at
>>>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)
>>>> at
>>>> org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:402)
>>>> at
>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:116)
>>>>
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> On Tue, Feb 9, 2010 at 7:46 PM, ariekenb <[email protected]>
>>>>> wrote:
>>>>>>
>>>>>> I'm running apache-servicemix 4.1.0-psc-01-00RC1, using the included
>>>>>> version
>>>>>> of ActiveMQ and Camel. I have some code that's receiving a message
>>>>>> from
>>>>>> an
>>>>>> ActiveMQ queue, then sending a message to the temporary queue it got
>>>>>> from
>>>>>> JMSReplyTo.
>>>>>>
>>>>>> �...@endpointinject
>>>>>> private ProducerTemplate producerTemplate = null;
>>>>>>
>>>>>>
>>>>>> �...@consume(uri = "subscriptionRequestEndpoint")
>>>>>> public synchronized void processSubscriptionRequest(
>>>>>> �...@header("JMSReplyTo") Destination jmsReplyTo,
>>>>>> �...@body SubscriptionManagerRegister
>>>>>> registrationMessage) {
>>>>>> try {
>>>>>> log.info("got registration request client name
>>>>>> =
>>>>>> "
>>>>>> +
>>>>>> registrationMessage.getClientName() + " jmsReplyTo = "
>>>>>> + jmsReplyTo);
>>>>>> tempQueueList.add((TemporaryQueue)
>>>>>> jmsReplyTo);
>>>>>> publishMessageToSubscriber((TemporaryQueue)
>>>>>> jmsReplyTo, "hello");
>>>>>> } catch (Exception e) {
>>>>>> log.warn("processSubscriptionRequest", e);
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> public synchronized void publishMessageToSubscriber(
>>>>>> TemporaryQueue temporaryQueue, Serializable
>>>>>> message) {
>>>>>> try {
>>>>>> final String endpointName =
>>>>>> "activemq:temp:queue:"
>>>>>> +
>>>>>> temporaryQueue.getQueueName();
>>>>>> producerTemplate.sendBody(endpointName,
>>>>>> message);
>>>>>> } catch (Exception e) {
>>>>>> log.warn("publishMessageToSubscriber", e);
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> When the producerTemplate.sendBody call runs, I get the following
>>>>>> exception.
>>>>>> Is this a camel bug or am I doing something wrong?
>>>>>>
>>>>>> org.springframework.jmx.export.metadata.InvalidMetadataException: No
>>>>>> ManagedResource attribute found for class: class
>>>>>> org.apache.camel.component.jms.JmsTemporaryQueueEndpoint
>>>>>> at
>>>>>> org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler.populateMBeanDescriptor(MetadataMBeanInfoAssembler.java:279)
>>>>>> at
>>>>>> org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler.getMBeanInfo(AbstractMBeanInfoAssembler.java:69)
>>>>>> at
>>>>>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:202)
>>>>>> at
>>>>>> org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:193)
>>>>>> at
>>>>>> org.apache.camel.management.ManagedManagementStrategy.manageNamedObject(ManagedManagementStrategy.java:69)
>>>>>> at
>>>>>> org.apache.camel.management.ManagedManagementStrategy.manageObject(ManagedManagementStrategy.java:62)
>>>>>> at
>>>>>> org.apache.camel.management.DefaultManagementLifecycleStrategy.onEndpointAdd(DefaultManagementLifecycleStrategy.java:185)
>>>>>> at
>>>>>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:432)
>>>>>> at
>>>>>> org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:402)
>>>>>> at
>>>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:116)
>>>>>>
>>>>>>
>>>>>
>>>>> At what level do this stacktrace get logged? ERROR, DEBUG, INFO etc?
>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/Attemp-to-send-message-to-activemq-temporary-queue-using-producerTemplate%3A-InvalidMetadataException-tp27520096p27520096.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Attemp-to-send-message-to-activemq-temporary-queue-using-producerTemplate%3A-InvalidMetadataException-tp27520096p27532128.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Attemp-to-send-message-to-activemq-temporary-queue-using-producerTemplate%3A-InvalidMetadataException-tp27520096p27532910.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
http://old.nabble.com/file/p27574989/camel.temp.queue.test.zip
camel.temp.queue.test.zip
--
View this message in context:
http://old.nabble.com/Attemp-to-send-message-to-activemq-temporary-queue-using-producerTemplate%3A-InvalidMetadataException-tp27520096p27574989.html
Sent from the Camel - Users mailing list archive at Nabble.com.