1 2 3 Previous Next 35 Replies Latest reply on Nov 13, 2002 1:28 PM by francesco calderini

    SonicMQ intergration

    Peter Antman Expert

      Hi,
      first I just have to say this: what a strange implementation SonicMQ has done for its ASF support!!!

      Second: I now have (as far as I can tell) a working SonicMQ integreation with XA support (both MDB and the JCA ra). Unfortunately I currently do not have the time to put this together in a nice package for 3.0 and 2.4.5 (personally I have had to do the integration agains 2.4.3).

      But if someone is interested and have the time to put up a nice contrib package I can share my current code and and code snippets on how to solve it. That is if anyone is really interested in SonicMQ.

      //Peter

        • 1. Re: SonicMQ intergration
          Hiram Chirino Expert

          What's so strange??? Did you pickup any good ideas??

          Regards,
          Hiram

          • 2. Re: SonicMQ intergration
            Craig Day Newbie

            Id like to take a look at what you needed to do. Im in the position where I have to choose a messaging solution to support a new large development (with JBoss3), and SonicMQ is the product im most interested in. I can take care of the the JBoss3 integration if we go with it... p.s. how much does progress charge for SonicMQ? Its a public holiday here so they arent answering their phones, and i need to make a decision tomorrow :)

            cheers
            craig

            • 3. Re: SonicMQ intergration
              Peter Antman Expert

              No, not at all.

              What's strange is that their ConnectionConsumer can't take an XAConnection, but must have a normal connection. But to get at the XAResource in the pool we have to use the XA one. And since the consumer uses a normal connection it expect a normal session.

              From the Sonic forum ther recomendation is to do this with some unstated magic by also creating a normal connection. Looking around a little a found you had to do it this way:

              1. Create an XA connection.
              2. Set up the pool with this.
              3. Get bot the XA session, and the normal session through the XA session (as we do today).
              4. Get the normal connection by using a propreitary/Sonic typcast,eg:
              if(con instanceof progress.message.jclient.xa.XATopicConnection) {
              con = ((progress.message.jclient.xa.XATopicConnection)con).getTopicConnection();
              }

              5. Create the connection Consumer againt that connection.
              6. In ServerSession return the normal session and not the XA session.

              Do you see what I am getting at here:

              You get stuff from the XAConnection, but the sonic code itself can not handle it.

              What if they had written a connection consumer that check if it where given a connection of XA type and called the sonic specific getXXXConnection, and if the ServerSession returned an XASession called the getXXXSession. Then all would work as expected. Instead they have done a shit implementation which forces implementors to use Sonic special stuff and figure out how the sonic ASF stuff works under the hood...

              //Peter

              • 4. Re: SonicMQ intergration
                Peter Antman Expert

                You can get the jboss-sonic.zip from http://www.backsource.org/source/java/jboss/

                //Peter

                • 5. Re: SonicMQ intergration
                  Calvin Newbie

                  Peter,

                  Will this allow me to accomplish the question that I posted here:

                  http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ handling messages from SonicMQ located on separate box

                  I was wondering if this was possible. It must be but after searching through the JBoss book and the forum, I haven't seen anyone do or ask about this yet. I've seen how some people have replaced JBossMQ with SonicMQ but this isn't what I want to do.

                  I want to leave the default JBoss JMS server in place. However, I want to have some MDBs handle messages that are posted onto a SonicMQ queue on a separate box. Basically, I have SonicMQ running on box1 and JBoss running on box 2 with some MDBs that have subscribed
                  themselves to handle messages on the Sonic queue on box 1.

                  If this is possible, I'd appreciate any help or related experiences. Thanks guys.

                  • 6. Re: SonicMQ intergration
                    Peter Antman Expert

                    Works like a charm.

                    • 7. Re: SonicMQ intergration
                      Calvin Newbie

                      Peter,

                      I've changed your code to work with JBoss 2.4.4 and built the source files you provided
                      into their own jar. I'm trying to get my MDB to work with it but when I deploy it I get
                      the following ClassCastException.

                      [INFO,ContainerFactory] Deploying TransactionServiceEJB
                      [ERROR,MessageDrivenContainer] Serious error in init:
                      java.lang.ClassCastException: progress.message.jclient.Queue
                      at org.jboss.mq.SpyConnectionConsumer.(SpyConnectionConsumer.java:68)
                      at org.jboss.mq.SpyConnection.createConnectionConsumer(SpyConnection.java:110)
                      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.init(JMSContainerInvoker.java:545)
                      at org.jboss.ejb.MessageDrivenContainer.init(MessageDrivenContainer.java

                      I'm wondering if this is because of the way I've built it and deployed it.
                      I've just added the jar I built with your classes to the jboss/lib/ext directory. Hopefully this is fine though.

                      The MDB I've redeployed to use a Queue on my Sonic server. This MDB works correctly on a JBoss Queue. Just
                      in case it may help, below is my ejb-jar.xml, jboss.xml, and jboss.jcml entry for my MDB:

                      <ejb-jar>
                      <enterprise-beans>
                      <message-driven>
                      <ejb-name>TransactionServiceEJB</ejb-name>
                      <ejb-class>com.foo.TransactionServiceEJB</ejb-class>
                      <transaction-type>Container</transaction-type>
                      <message-driven-destination>
                      <destination-type>javax.jms.Queue</destination-type>
                      </message-driven-destination>
                      <resource-ref>
                      <res-ref-name>jms/QCF</res-ref-name>
                      <res-type>javax.jms.QueueConnectionFactory</res-type>
                      <res-auth>Container</res-auth>
                      </resource-ref>
                      </message-driven>
                      </enterprise-beans>
                      </ejb-jar>


                      <enterprise-beans>
                      <message-driven>
                      <ejb-name>TransactionServiceEJB</ejb-name>
                      <destination-jndi-name>queue/MyTransactionQ</destination-jndi-name>
                      <!--<destination-jndi-name>queue/B</destination-jndi-name>-->
                      <resource-ref>
                      <res-ref-name>jms/QCF</res-ref-name>
                      <jndi-name>QueueConnectionFactory</jndi-name>
                      <!--<jndi-name>SonicMQQueueConnectionFactory</jndi-name>-->
                      </resource-ref>
                      </message-driven>
                      </enterprise-beans>



                      SonicJMSProvider
                      org.jboss.jms.jndi.JBossMQProvider
                      SonicMQQueueConnectionFactory
                      SonicMQTopicConnectionFactory
                      tcp://localhost:2506


                      MyTransactionQ



                      Thanks for any help you might be able to give me.

                      • 8. Re: SonicMQ intergration
                        Peter Antman Expert

                        You must create a custom container configuration for your MDB where you specify the SonicContainerInvoker as your inviker, and configures the DLQ. You must also see patch jboss.jar with the org.jboss.xxx classes.

                        //Peter

                        • 9. Re: SonicMQ intergration
                          Calvin Newbie

                          Please forgive my ignorance. I'm not all that knowledgeable about the JBoss internals.

                          >You must create a custom container configuration for >your MDB where you specify the SonicContainerInvoker as >your inviker, and configures the DLQ.

                          I'm completely lost here. I don't understand what files I have to change.


                          >You must also see patch jboss.jar with the org.jboss.xxx >classes.

                          Do you mean that I need to replace the classes that you patched into jboss.jar?

                          Thanks for your help and patience.

                          • 10. Re: SonicMQ intergration
                            Peter Antman Expert

                            jboss.xml may contain a container-configurations element, where you override the default values in standardjboss.xml. Thats where you configure the invoker.

                            And yes, you need to put the patched JBoss JMSContainerInvoker and DLQHandler i jboss.jar.

                            //Peter

                            • 11. Re: SonicMQ intergration
                              Calvin Newbie

                              Peter,

                              Well, I'm getting closer. I got everything packaged up in JBoss.jar and changed my
                              standardjboss.xml file to SonicJMSProvider.
                              However, I'm now getting the following exception:

                              [ERROR,JMSContainerInvoker] Could not init JMSContainerInvoker: javax.jms.JMSExc
                              eption: can not return a created XAQueueSession as a QueueSession.
                              javax.jms.JMSException: can not return a created XAQueueSession as a QueueSession.
                              at progress.message.jimpl.JMSExceptionUtil.createJMSException(Unknown So
                              urce)
                              at progress.message.jimpl.xa.XAQueueConnection.createQueueSession(Unknow
                              n Source)
                              at progress.message.jimpl.aspi.us.(Unknown Source)
                              at progress.message.jimpl.aspi.CCFactory.createConnectionConsumer(Unknow
                              n Source)
                              at progress.message.jimpl.QueueConnection.createConnectionConsumer(Unkno
                              wn Source)
                              at org.jboss.ejb.plugins.jms.JMSContainerInvoker.init(Unknown Source)
                              at org.jboss.ejb.MessageDrivenContainer.init(MessageDrivenContainer.java


                              Any idea what I forgot to do or what I need to change? Thanks again. BTW - After I get this
                              working on 2.4.4, I'd like to get it running on JBoss 3.0. If you need any help with writing
                              up some documentation or anything for a contrib package, I'd be more than happy to help out.

                              • 12. Re: SonicMQ intergration
                                Peter Antman Expert

                                It seems as if you still uses the old container invoker.

                                You must change the container invoker to be the Sonic one.
                                //Peter

                                • 13. Re: SonicMQ intergration
                                  Calvin Newbie

                                  Yup, you were right. I didn't get my container invoker changed in standardjboss.xml to the Sonic one. That took me forever to find. Now it works and I'm really happy. You did an awesome job. Thanks so much for your help.

                                  I'm going to now attempt to get this to work with JBoss 3.0. Let me know if you want any help with documentation for a contrib package.

                                  You rock dude - later!

                                  • 14. Re: SonicMQ intergration
                                    Calvin Newbie

                                    Peter,

                                    I got this running on JBoss 3.0RC1 today. Something that I've not been able to figure out is why I keep getting Warning messages stating that the transaction has a duplicate (XAMessage.XAER_DUPID) or isn't valid (XAMessage.XAER_NOTA) on just about every message my MDB gets when a commit is called on the transaction. This was happening in JBoss 2.4.4 also. Everything seems to work but this is a little weird. Any ideas?



                                    15:13:59,015 WARN [TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=mybox//6, BranchQual=] errorCode=XAER_NOTA
                                    javax.transaction.xa.XAException
                                    at progress.message.jimpl.xa.XAResource.commit(Unknown Source)
                                    at org.jboss.tm.TxCapsule.commitResources(TxCapsule.java:1656)
                                    at org.jboss.tm.TxCapsule.commit(TxCapsule.java:357)
                                    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
                                    at org.jboss.jms.providers.sonic.SonicServerSession.onMessage(Unknown So
                                    urce)
                                    at progress.message.jimpl.Session.OOB_(Unknown Source)
                                    at progress.message.jimpl.Session.run(Unknown Source)
                                    at progress.message.jimpl.QueueSession.run(Unknown Source)
                                    at org.jboss.jms.providers.sonic.SonicServerSession.run(Unknown Source)
                                    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec

                                    1 2 3 Previous Next