1 2 3 Previous Next 63 Replies Latest reply on Mar 19, 2008 2:39 AM by beve

    Trouble with jms-topic

    standard

      Hi,

      I have two questions regarding jms-topics.
      I defined a service listening on a jms-topic.
      The topic is created by another (publisher-) service.

      First:
      When I define the provider like that:

      
       <jms-provider name="JBossMessaging" connection-factory="ConnectionFactory">
      
       <jms-bus busid="canonicalCourseTopic">
       <jms-message-filter
       dest-type="TOPIC"
       dest-name="topic/topic_name"
       />
      


      I get the error that no topic with name "topic/topic_name" is defined,
      when I deploy my service.

      StackTrace:

      
      javax.jms.JMSException: There is no administratively defined topic with name:topic/topic_name
       at org.jboss.jms.server.endpoint.ServerSessionEndpoint.createTopic(ServerSessionEndpoint.java:260)
       at org.jboss.jms.server.endpoint.advised.SessionAdvised.org$jboss$jms$server$endpoint$advised$SessionAdvised$createTopic$aop(SessionAdvised.java:103)
       at org.jboss.jms.server.endpoint.advised.SessionAdvised$createTopic_N1144803973659535745.invokeNext(SessionAdvised$createTopic_N1144803973659535745.java)
       at org.jboss.jms.server.container.ServerLogInterceptor.invoke(ServerLogInterceptor.java:105)
       at org.jboss.jms.server.endpoint.advised.SessionAdvised$createTopic_N1144803973659535745.invokeNext(SessionAdvised$createTopic_N1144803973659535745.java)
       at org.jboss.jms.server.endpoint.advised.SessionAdvised.createTopic(SessionAdvised.java)
       at org.jboss.jms.wireformat.SessionCreateTopicRequest.serverInvoke(SessionCreateTopicRequest.java:74)
       at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:141)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:101)
       at org.jboss.remoting.Client.invoke(Client.java:1550)
       at org.jboss.remoting.Client.invoke(Client.java:530)
       at org.jboss.remoting.Client.invoke(Client.java:518)
       at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:186)
       at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:157)
       at org.jboss.jms.client.delegate.ClientSessionDelegate.org$jboss$jms$client$delegate$ClientSessionDelegate$createTopic$aop(ClientSessionDelegate.java:316)
       at org.jboss.jms.client.delegate.ClientSessionDelegate$createTopic_N1144803973659535745.invokeNext(ClientSessionDelegate$createTopic_N1144803973659535745.java)
       at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:91)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
       at org.jboss.jms.client.delegate.ClientSessionDelegate$createTopic_N1144803973659535745.invokeNext(ClientSessionDelegate$createTopic_N1144803973659535745.java)
       at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
       at org.jboss.jms.client.delegate.ClientSessionDelegate$createTopic_N1144803973659535745.invokeNext(ClientSessionDelegate$createTopic_N1144803973659535745.java)
       at org.jboss.jms.client.delegate.ClientSessionDelegate.createTopic(ClientSessionDelegate.java)
       at org.jboss.jms.client.JBossSession.createTopic(JBossSession.java:260)
       at org.jboss.internal.soa.esb.couriers.JmsCourier.createMessageConsumer(JmsCourier.java:440)
       at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:316)
       at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:223)
       at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:205)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:268)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:252)
       at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
       at java.lang.Thread.run(Thread.java:595)
      
      



      But when I define the provider like that:

       <jms-provider name="JBossMessaging" connection-factory="ConnectionFactory">
      
       <jms-bus busid="canonicalCourseTopic">
       <jms-message-filter
       dest-type="TOPIC"
       dest-name="topic_name"
       />
      


      without the "topic/" I don't get that error.
      With my queues I always define the provider with "queue/queue_name",
      and in the jms-topic quickstart, the provider is also defined with "topic/topic_name".
      Whats the right way to define the providers, or is this just a bug in my ESB version?
      ESB version is: jbossesb-server-4.2GA



      Second:
      When I want so publish a TextMessage inside the publisher-service like that:

      
      TopicSession ts;
      TopicPublisher tp;
      TopicConnection tc;
      Topic topic;
      TopicConnectionFactory tcf;
      
      Context jndiContext = new InitialContext();
      tcf = (TopicConnectionFactory) jndiContext.lookup("ConnectionFactory");
      topic = (Topic) jndiContext.lookup(topicName);
      tc = tcf.createTopicConnection();
      ts = tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      tp = ts.createPublisher(topic);
      tc.start();
      
      String text = someXMLasString;
      TextMessage textMessage = ts.createTextMessage(text);
      tp.publish(topic, textMessage);
      
      


      I get the Error (no Exception):

      14:44:58,562 ERROR [JmsCourier] Unsupported JMS message type: org.jboss.jms.message.TextMessageProxy
      


      Isn't that the right way to do it? What can I do to work around this?

      Thanks
      Andreas



        • 1. Re: Trouble with jms-topic
          beve

          Hi Andreas,

          have you taken a look at the jms_topic quickstart. This might give some hints on you issues.


          The topic is created by another (publisher-) service.

          Is your service dependent on that service that creates the topic?
          Something like this should be in META-INF/deploment.xml:
          <?xml version="1.0" encoding="UTF-8"?>
          <jbossesb-deployment>
           <depends>jboss.esb:deployment=your_services_name.esb</depends>
          </jbossesb-deployment>
          

          Perhaps you are already doing this? You could specify a dependency on the service that creates the topic or the topic itself it would think.

          Regards,

          Daniel


          • 2. Re: Trouble with jms-topic
            beve

            About you second question...
            Do you have a JMS gateway listening to that Topic?

            Regards,

            Daniel

            • 3. Re: Trouble with jms-topic
              standard

              Hi,

              I defined a dependency to the topic, but just tried defining a dependency to the service too (still the same). I also tried to define the topic in "..\deploy\jboss-messaging.sar\destinations-service.xml", which also made no difference.
              The publisher e.g. can find it with:

              
              (Topic) jndiContext.lookup("topic/topic_name");
              
              


              also using "topic/".
              The problem doesn't seem to be that the topic isn't there,
              because in that case I think I would get errors regarding the dependency (which I don't).

              It seems it's just the listener that can't find the topic under that name (with "topic\" in the name).
              The jms-topic quickstart btw also uses "topic\" when referencing the topic.

              Thanks
              Andreas


              • 4. Re: Trouble with jms-topic
                standard

                Hi,

                right now only the consumer-service is listening with:

                 <providers>
                 <jms-provider name="JBossMessaging" connection-factory="ConnectionFactory">
                
                 <jms-bus busid="topicChannel">
                 <jms-message-filter
                 dest-type="TOPIC"
                 dest-name="topic_name"
                 />
                 </jms-bus>
                
                 </jms-provider>
                 </providers>
                 ....
                 <listeners>
                 <jms-listener name="topicListener"
                 busidref="topicChannel"
                 maxThreads="1"
                 />
                 ....
                
                


                Isn't that the right way?

                Thanks
                Andreas

                • 5. Re: Trouble with jms-topic
                  beve

                  Hi Andreas,

                  the listener that you have specified is a esb-aware listener.
                  It expects that the the incoming message is an ObjectMessage containing a serialized ESB Message Object.
                  If you want to invoke a service directly without going through at gateway you can use the ServiceInvoker.

                  Another alternative is to configure a JMS Gateway which will take care of the packaging of the content into the JMS message.


                  Regards,

                  Daniel

                  • 6. Re: Trouble with jms-topic
                    standard

                    Hi,

                    thanks!
                    I'll try doing it with ObjectMessages then.

                    Regards
                    Andreas

                    • 7. Re: Trouble with jms-topic
                      beve

                      Hi,

                      I think you would be better of using a gateway. Or using the ServiceInvoker.

                      If you only change the type of the JMS message from TextObject to ObjectMessage you will run into problems when the Courier tries to deserialize the Object in the ObjectMessage.

                      Does that make sense?

                      Regards,

                      Daniel

                      • 8. Re: Trouble with jms-topic
                        standard

                        Hi,

                        I always thought that I just need gateways when entering or leaving the ESB,
                        (e.g. I use a File-Gateway for Filedrops, and a JMS-Gateway for messages from another System)
                        but it is very possible that I got that wrong :-).

                        Can you recommend a quickstart or something like that, where I can see such a "internal" gateway?


                        To the ServiceInvoker:
                        I usually use the Invoker to pass messages between services,
                        but I don't really know how to realize something like publisher/subscriber with this,
                        and I would need that in this case.
                        Is that possible?

                        Thanks for the help so far!
                        Regards

                        Andreas

                        • 9. Re: Trouble with jms-topic
                          beve

                          Yes, you correct about the gateway stuff.
                          I was thinking that your publisher was another application, but as you said it is another service.
                          So, as long as you are using an ObjectMessage with the object being the ESB message object you should be right. Sorry if I confused you there:(

                          I think would should be able to get the same result by having your service setup like you decribed and using the ServiceInoker to send the message async to it.
                          Wouldn't that give you the same result as publishing the message to the topic like you are now?

                          Regards,

                          Daniel

                          • 10. Re: Trouble with jms-topic
                            standard

                            Hi,

                            I actually tried it with "is-gateway="true"" on the subscriber listener,
                            but got an classCastException:

                             org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException: java.lang.ClassCastException: org.jboss.jms.destination.JBossTopic
                            


                            but if thats not the way to go, I'll leave it at that.

                            Like I sayed, I would really like to use the service-invoker,
                            but the way I used it until now was:

                            new ServiceInvoker("Category", "ServiceName").deliverAsync(esbMessage);
                            


                            so I have to know the recipient(s) of the message.
                            Or is there another way to use the ServiceInvoker, so that recipients can subscribe to the message?

                            Thanks
                            Andreas


                            • 11. Re: Trouble with jms-topic
                              standard

                              Hi,

                              I also tried to pack an esb-message into the ObjectMessage now.
                              Here is what I did:

                              
                               // message = an esb-message
                              
                               ObjectMessage objMessage = ts.createObjectMessage();
                               objMessage.setObject(message);
                               String id = UUID.randomUUID().toString();
                               objMessage.setJMSCorrelationID(id);
                              
                               tp.publish(topic, objMessage);
                              
                              


                              When I run this, I get an exception at setObject() with following StackTrace

                              
                              18:45:40,687 ERROR [STDERR] java.lang.RuntimeException: org.jboss.internal.soa.esb.message.format.xml.BodyImpl
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
                              18:45:40,687 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
                              18:45:40,687 ERROR [STDERR] at org.jboss.messaging.util.StreamUtils.writeObject(StreamUtils.java:249)
                              18:45:40,687 ERROR [STDERR] at org.jboss.messaging.core.message.MessageSupport.writePayload(MessageSupport.java:427)
                              18:45:40,687 ERROR [STDERR] at org.jboss.messaging.core.message.MessageSupport.getPayloadAsByteArray(MessageSupport.java:239)
                              18:45:40,703 ERROR [STDERR] at org.jboss.jms.message.JBossObjectMessage.setObject(JBossObjectMessage.java:113)
                              18:45:40,703 ERROR [STDERR] at org.jboss.jms.message.ObjectMessageProxy.setObject(ObjectMessageProxy.java:59)
                              18:45:40,703 ERROR [STDERR] at de.tum.esb.service.cancoursemsg.publish.Action_PublishCourse.publishMsg(Action_PublishCourse.java:114)
                              18:45:40,703 ERROR [STDERR] at de.tum.esb.service.cancoursemsg.publish.Action_PublishCourse.process(Action_PublishCourse.java:63)
                              18:45:40,703 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              18:45:40,703 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              18:45:40,703 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              18:45:40,703 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
                              18:45:40,703 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102)
                              18:45:40,703 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74)
                              18:45:40,703 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:265)
                              18:45:40,703 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:297)
                              18:45:40,703 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                              18:45:40,703 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                              18:45:40,703 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                              
                              


                              so no luck there either :-)

                              Regards
                              Andreas

                              • 12. Re: Trouble with jms-topic
                                beve

                                One thought is that you could use the TopicNotifier to send the message to the Topic.
                                This would then be configured as an action in you jboss-esb.xml.
                                Take a look at the helloworld_topic_notifier quickstart and see if that would work for you.

                                Regards,

                                Daniel

                                • 13. Re: Trouble with jms-topic
                                  standard

                                  Hi,

                                  thanks for the answer.
                                  Could you tell me where to find this quickstart.
                                  I have jbossesb-server-4.2.1GA and jbossesb-server-4.2GA here,
                                  and neither of these have the quickstart included.

                                  Regards
                                  Andreas

                                  • 14. Re: Trouble with jms-topic
                                    standard


                                    Ok found it with google,
                                    will try that.
                                    At first glance it could be what I'm looking for.

                                    Thanks for the help so far!

                                    Regards
                                    Andreas

                                    1 2 3 Previous Next