2 Replies Latest reply on Dec 3, 2012 8:47 PM by toby saville

    How get payload from a message ?

    everson . Newbie

      Hi!

       

       

      i'm using jboss esb and in my message body there's an object, like Person. When something get wrong the message will go to queue/DLQ on jboss.

      I would like get that object Person again from queue/DLQ. I'm trying the code below, but i can't ... Anyone know how can I do that ?

       

       

      QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) iniCtx.lookup("ConnectionFactory");

      connection = queueConnectionFactory.createQueueConnection();

      queue = (Queue) iniCtx.lookup("/queue/DLQ");

      session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

      connection.start();

      System.out.println("Connection Started");

       

      MessageConsumer consumer =  session.createConsumer(queue);

      ObjectMessageProxy omp = (ObjectMessageProxy) consumer.receive(2000);

      System.err.println( omp.getMessage()); //show me it ---> JBossMessage[21445453972357131]:PERSISTENT

      JBossMessage jbm = omp.getMessage();

       

      When I use jbm.getPayload(), get it:

       

       

       

      <Envelope>

          <Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

              <wsa:To>jms:localhost:1099#queue/my_esb</wsa:To>

              <jbossesb:java.naming.factory.initial

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">org.jnp.interfaces.NamingContextFactory</jbossesb:java.naming.factory.initial>

              <jbossesb:java.naming.provider.url

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">localhost:1099</jbossesb:java.naming.provider.url>

              <jbossesb:java.naming.factory.url.pkgs

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">org.jnp.interfaces</jbossesb:java.naming.factory.url.pkgs>

              <jbossesb:destination-type

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">queue</jbossesb:destination-type>

              <jbossesb:destination-name

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">queue/my_esb</jbossesb:destination-name>

              <jbossesb:specification-version

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">1.1</jbossesb:specification-version>

              <jbossesb:connection-factory

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">XAConnectionFactory</jbossesb:connection-factory>

              <jbossesb:persistent xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">true</jbossesb:persistent>

              <jbossesb:acknowledge-mode

                  xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">AUTO_ACKNOWLEDGE</jbossesb:acknowledge-mode>

              <jbossesb:transacted xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">false</jbossesb:transacted>

              <jbossesb:type xmlns:jbossesb="http://schemas.jboss.com/ws/2007/01/jbossesb">urn:jboss/esb/epr/type/jms</jbossesb:type>

              <wsa:MessageID>b28656d6-cd7c-4e02-b78f-393c6bd8d3a8</wsa:MessageID>

          </Header>

          <Context />

          <Body>

              <Content>

                  <Key>b3JnLmpib3NzLnNvYS5lc2IubWVzc2FnZS5kZWZhdWx0RW50cnk=</Key>

                  <Value>

                      <marshalunmarshal>

                          <plugin-type>urn:xml/marshalunmarshal/plugin/serialization</plugin-type>

                          rO0ABXNyADpici5zZW5haS5zYy5pbnRlZ3JhY2FvLmNvbW1vbi5kdG8uQ29sYWJvcmFkb3JJbnRlZ3JhY2FvRFRPAAAAAAAAAAECABZMABJjaWRhZGVOYXR1cmFsaWRhZGV0ABJMamF2YS9sYW5nL1N0cmluZztMAA1jb250cmF0b3NMaXN0dAAQTGphdmEvdXRpbC9MaXN0O0wAA2NwZnEAfgABTAAPZGF0YUZhbGVjaW1lbnRvdAAQTGphdmEvdXRpbC9EYXRlO0wACmVtYWlsc0xpc3RxAH4AAkwADWVuZGVyZWNvc0xpc3RxAH4AAkwAEmVzdGFkb05hdHVyYWxpZGFkZXEAfgABTAAGZ2VuZXJvcQB+AAFMAA1uYWNpb25hbGlkYWRldAAfTGJyL3NlbmFpL3NjL2VudGl0eS9zZW5haS9QYWlzO0wAEG5hY2lvbmFsaWRhZGVTdHJx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LmludGVncmFjYW8uUGVzc29hSW50ZWdyYWNhbwAAAAAAAAABAgAGTAAJYWx0ZXJhY2FvcQB+AANMAAdjcmlhY2FvcQB+AANMAAtpZEFwbGljYWNhb3EAfgAOTAAJaWRFeHRlcm5vcQB+AA5MAAhpZFBlc3NvYXEAfgAOTAAGcGVzc29hcQB+ADh4cgAlYnIuc2VuYWkuc2MuY29tbW9uLmVudGl0eS5TRU5BSUVudGl0eQAAAAAAAAABAgADSgALaWRJbnN0YW5jaWFaAApwZXJzaXN0ZW50TAAIbGlzdGVuZXJ0AC9MYnIvc2VuYWkvc2MvY29tbW9uL2VudGl0eS9TRU5BSUVudGl0eUxpc3RlbmVyO3hwAAABMMMMIqsAcHBwc3EAfgAcAAAAAAAAAANzcQB+ABwAAAAAAANBAHBwcHQAB0FtYXJlbGF0AAczNDU0NTQ1dAADc3NwcHQACUVtcHJlZ2Fkb3NxAH4ACgAAAAN3BAAAAApzcgBFYnIuc2VuYWkuc2MuaW50ZWdyYWNhby5jb21tb24uc21vb2tzLmNvbGFib3JhZG9yLlBlc3NvYVRlbGVmb25lU21vb2tzAAAAAAAAAAECAAhMABBpZFBlc3NvYVRlbGVmb25lcQB+AA5MABBub21lUGVzc29hUmVjYWRvcQB+AAFMAAZudW1lcm9xAH4AAUwABW9yZGVtcQB+ADdMAAZwZXNzb2FxAH4AOEwADHBlc3NvYVJlY2Fkb3EAfgABTAAFcmFtYWxxAH4AAUwABHRpcG9xAH4AAXhwcHQACUx1bHV6aW5oYXQACDk5OTk2NjMzcHBwdAADMjU2dAAHQ2VsdWxhcnNxAH4AZXB0AAlMdWx1emluaGF0AAg5OTk5NjYzM3BwcHQAAzI1NnEAfgBqc3EAfgBlcHQACUx1bHV6aW5oYXQACDk5OTk2NjMzcHBwdAADMjU2cQB+AGp4

                      </marshalunmarshal>

                  </Value>

              </Content>

          </Body>

          <Attachment />

          <Properties>

              <Property>

                  <Key>b3JnLmpib3NzLnNvYS5lc2IubWVzc2FnZS50cmFuc3BvcnQudHlwZQ==</Key>

                  <Value>rO0ABX5yAC9vcmcuamJvc3Muc29hLmVzYi5jb21tb24uRW52aXJvbm1lbnQkVHJhbnNwb3J0cwAAAAAAAAAAEgAAeHIADmphdmEubGFuZy5FbnVtAAAAAAAAAAASAAB4cHQAA0pNUw==</Value>

              </Property>

              <Property>

                  <Key>b3JnLmpib3NzLnNvYS5lc2IubWVzc2FnZS5zb3VyY2U=</Key>

                  <Value>rO0ABXQAWFBvcnRSZWZlcmVuY2UgPCBqbXM6bG9jYWxob3N0OjEwOTkjcXVldWUvc2VuYWlfaW50ZWdyYWNhb19wZXNzb2FfY29sYWJvcmFkb3JhY3Rpb25fZXNiID4=</Value>

              </Property>

          </Properties>

      </Envelope>

        • 1. Re: How get payload from a message ?
          everson . Newbie

          Readind this *thread, I think what i want isn't possible ...

           

          *http://community.jboss.org/message/503094#503094

          • 2. Re: How get payload from a message ?
            toby saville Novice

            I know this is an old thread but i just came across the same issue. I resolved it by making my DLQ NOT a gateway.

             

            So i have a queue defined called retrieve_search_certificate_esb. it has a DLQ configured as such:

             

            <attribute name="DLQ">jboss.esb.destination:service=Queue,name=retrieve_search_certificate_dlq</attribute>

             

            which is in turn mapped to a jms-bus with a busId of retrSearchCertDlqChannel

             

            that jms-bus is configured by my service to be listened to by my service with

            <jms-listener name="ESB-Channel" busidref="retrSearchCertDlqChannel" is-gateway="false"/>

             

            the part that gave me access to my org.jboss.soa.esb.message.Message is: is-gateway="false" When is-gateway was true, the ESB Message was serialized to a String in the same way as the original post in this thread.