3 Replies Latest reply on Oct 29, 2015 7:34 AM by Matthew Karlsen

    Inserting Qpid Proton 0.10 in to HornetQ 2.4.0.Final -- possible?

    Matthew Karlsen Newbie

      Hello,

       

      I am presently trying to insert Qpid Proton 0.10 in to HornetQ 2.4.0.Final.

       

      I have tried multiple approaches but whenever I try to establish either the session or connection I run

      into fatal problems (in the example below, the code "hangs" with no error message when establishing the

      session).

       

      I will explain one of my approaches in the hope that someone may have some idea what is

      going on. If anyone has any pointers they would be much appreciated.

       

      Steps:

       

      1) Rename HornetQ's proton-j-impl.jar to proton-j-impl.jar.old (in "C:\Messaging\hornetq-2.4.0.Final\lib")

       

      2) Insert Qpid Proton 0.10 as proton-j-impl.jar

       

      3) Set up the config files in "C:\Messaging\hornetq-2.4.0.Final\config\stand-alone\non-clustered" (as supplied below; based on the ProtonJ example config files).

       

      4) Run server

       

      5) Copy the basic AMQP example from Artemis

       

      6) Adapt it.

       

      7) Run example.

       

      Any suggestions? Any clarifications/more info needed?

       

      Thank you & regards,

      Matthew

       

      #####################

      # hornetq-beans.xml #

      #####################

       

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <deployment xmlns="urn:jboss:bean-deployer:2.0">

       

         <!-- MBean server -->

         <bean name="MBeanServer" class="javax.management.MBeanServer">

            <constructor factoryClass="java.lang.management.ManagementFactory"

                         factoryMethod="getPlatformMBeanServer"/>

         </bean>

       

         <!-- The core configuration -->

         <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">

         </bean>

       

          <!-- The security manager -->

         <bean name="HornetQSecurityManager" class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">

            <start ignored="true"/>

            <stop ignored="true"/>

         </bean>

       

          <!-- The core server -->

         <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">

            <constructor>

               <parameter>

                  <inject bean="Configuration"/>

               </parameter>

               <parameter>

                  <inject bean="MBeanServer"/>

               </parameter>

               <parameter>

                  <inject bean="HornetQSecurityManager"/>

               </parameter>

            </constructor>

            <start ignored="true"/>

            <stop ignored="true"/>

         </bean>  

        

         <!-- The JMS server -->

         <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">

            <constructor>        

               <parameter>

                  <inject bean="HornetQServer"/>

               </parameter>        

            </constructor>

         </bean>

       

      </deployment>

       

      #############################

      # hornetq-configuration.xml #

      #############################

       

      <configuration xmlns="urn:hornetq"

                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

       

         <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>

       

         <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>

       

         <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>

       

         <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>

       

          <!-- Acceptors -->

          <acceptors>

              <acceptor name="proton-acceptor">

                  <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                  <param key="protocol" value="AMQP"/>

                  <param key="port" value="5672"/>

              </acceptor>

          </acceptors>


          <queues>

              <queue name="testQueue">

                  <address>testQueue</address>

              </queue>

          </queues>

       

         <!-- Other config -->

       

         <security-settings>

            <!--security for example queue-->

            <security-setting match="testQueue">

               <permission type="createDurableQueue" roles="guest"/>

               <permission type="deleteDurableQueue" roles="guest"/>

               <permission type="createNonDurableQueue" roles="guest"/>

               <permission type="deleteNonDurableQueue" roles="guest"/>

               <permission type="consume" roles="guest"/>

               <permission type="send" roles="guest"/>

            </security-setting>

         </security-settings>

       

      </configuration>

       

      ###################

      # hornetq-jms.xml #

      ###################

       

      <configuration xmlns="urn:hornetq"

                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

       

      </configuration>

       

      #####################

      # hornetq-users.xml #

      #####################

       

      <configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd">

         <!-- the default user.  this is used where username is null-->

         <defaultuser name="guest" password="guest">

            <role name="guest"/>

         </defaultuser>

      </configuration>

       

      ######################

      # logging.properties #

      ######################

       

      handlers=java.util.logging.ConsoleHandler

      java.util.logging.ConsoleHandler.formatter=org.hornetq.integration.logging.HornetQLoggerFormatter

      java.util.logging.FileHandler.level=INFO

      java.util.logging.FileHandler.formatter=org.hornetq.integration.logging.HornetQLoggerFormatter

      java.util.logging.FileHandler.pattern=logs/hornetq.log

      .level= INFO

       

      #########################

      # AMQPQueueExample.java #

      #########################

       

      /*

      * Licensed to the Apache Software Foundation (ASF) under one or more

      * contributor license agreements. See the NOTICE file distributed with

      * this work for additional information regarding copyright ownership.

      * The ASF licenses this file to You under the Apache License, Version 2.0

      * (the "License"); you may not use this file except in compliance with

      * the License. You may obtain a copy of the License at

      *

      *     http://www.apache.org/licenses/LICENSE-2.0

      *

      * Unless required by applicable law or agreed to in writing, software

      * distributed under the License is distributed on an "AS IS" BASIS,

      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

      * See the License for the specific language governing permissions and

      * limitations under the License.

      */

      package matt_protonj;

       

      import javax.jms.Connection;

      import javax.jms.ConnectionFactory;

      import javax.jms.MessageConsumer;

      import javax.jms.MessageProducer;

      import javax.jms.Queue;

      import javax.jms.Session;

      import javax.jms.TextMessage;

       

      import org.apache.qpid.jms.JmsConnectionFactory;

       

      public class AMQPQueueExample {

       

          public static void main(String[] args) throws Exception {

              Connection connection = null;

              ConnectionFactory connectionFactory = new JmsConnectionFactory("amqp://localhost:5672");

       

              try {

                  System.out.println("Step 1. Create an amqp qpid 1.0 connection");

                  connection = connectionFactory.createConnection("guest","guest");


                  System.out.println("Step 2. Create a session");

                  Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

       

                  System.out.println("Step 3. Create a sender");

                  Queue queue = session.createQueue("testQueue");

                  MessageProducer sender = session.createProducer(queue);

       

       

                  System.out.println("Step 4. send a few simple message");

                  sender.send(session.createTextMessage("Hello world "));

       

                  connection.start();

       

                  System.out.println("Step 5. create a moving receiver, this means the message will be removed from the queue");

                  MessageConsumer consumer = session.createConsumer(queue);

       

                  System.out.println("Step 7. receive the simple message");

                  TextMessage m = (TextMessage) consumer.receive(5000);

                  System.out.println("message = " + m.getText());

              }

              finally {

                  if (connection != null) {

                      System.out.println("Step 9. close the connection");

                      connection.close();

                  }

              }

          }

      }

        • 1. Re: Inserting Qpid Proton 0.10 in to HornetQ 2.4.0.Final -- possible?
          Matthew Karlsen Newbie

          Problem solved, I think. The server was not starting up correctly due to a problem in my hornetq-configuration.xml. I started with the original config and built towards the config I wanted and this solved the problem.

           

          Thanks & regards,

          Matthew

          • 2. Re: Inserting Qpid Proton 0.10 in to HornetQ 2.4.0.Final -- possible?
            Matthew Karlsen Newbie

            Hello again,

             

            [Note: also sent this to the Qpid mailing list -- will cross-post the solution (if it emerges) so that everyone benefits.]

             

            Last time I posted I was having issues with the basic sending and receiving of AMQP messages to/from HornetQ.

            I have got quite a bit further by myself (+ docs & e.g.s) but am sorry to say that I am stumped again...

             

            I have got HornetQ and the Qpid Proton examples configured and working with proton-api-0.4.jar, proton-j-impl-0.4.jar and

            proton-jms-0.4.jar. I have also set up a divert with a filter such that some messages are diverted from one queue to another.

             

            It all works fine...

             

            Unfortunately, the Qpid Proton library versions that I am using have a connection timeout hard-coded at 60 seconds (if I understand correctly).

             

            I believe this relates to https://developer.jboss.org/thread/233539?start=0&tstart=0 [How to set AMQP idle-timeout / ping frequency / TTL?]

             

            As I understand it, upgrading to proton-j-0.10.jar and proton-jms-0.10.jar should fix this issue by letting you specify the timeout.

             

            However, with the new jars, when trying to send/receive the message I am getting the error at the end of the message (below).

             

            Does anyone have an idea what may be going on?

             

            I have tried reading the documentation, wiki, e.t.c. (have spent about a day on this so far).

             

            Thanks & regards,

            Matthew

             

             

             

            Oct 27, 2015 2:48:47 PM org.apache.qpid.proton.driver.impl.ConnectorImpl read

            SEVERE: ConnectorImpl [_channel=java.nio.channels.SocketChannel[connected local=/127.0.0.1:52583 remote=localhost/127.0.0.1:5672]] error processing input

            org.apache.qpid.proton.engine.TransportException: unknown frame type: 0

              at org.apache.qpid.proton.engine.impl.SaslFrameParser.input(SaslFrameParser.java:183)

              at org.apache.qpid.proton.engine.impl.SaslImpl$SaslTransportWrapper.reallyProcessInput(SaslImpl.java:630)

              at org.apache.qpid.proton.engine.impl.SaslImpl$SaslTransportWrapper.process(SaslImpl.java:601)

              at org.apache.qpid.proton.engine.impl.HandshakeSniffingTransportWrapper.process(HandshakeSniffingTransportWrapper.java:101)

              at org.apache.qpid.proton.engine.impl.TransportImpl.process(TransportImpl.java:1415)

              at org.apache.qpid.proton.driver.impl.ConnectorImpl.read(ConnectorImpl.java:135)

              at org.apache.qpid.proton.driver.impl.ConnectorImpl.process(ConnectorImpl.java:94)

              at org.apache.qpid.proton.messenger.impl.MessengerImpl.processActive(MessengerImpl.java:738)

              at org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:890)

              at org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:839)

              at org.apache.qpid.proton.messenger.impl.MessengerImpl.send(MessengerImpl.java:417)

              at org.apache.qpid.proton.messenger.impl.MessengerImpl.send(MessengerImpl.java:394)

              at qpid.SendOld.run(SendOld.java:93)

              at qpid.SendOld.main(SendOld.java:56)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:497)

              at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

            • 3. Re: Inserting Qpid Proton 0.10 in to HornetQ 2.4.0.Final -- possible?
              Matthew Karlsen Newbie

              To summarise Apache Qpid users - "unknown frame type: 0" after upgrading proton-j jar and proton jms jar (0.4 -> 0.10) in HornetQ (fi…, no it's not possible -- at least not without a great deal of modification due to the extensive re-factoring that occurred between the two versions.

               

              Thanks & regards,

              Matthew