Announcement Announcement Module
No announcement yet.
spring config/channel error/error handler Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Interesting. Are you sure that you only have one active consumer on the Queue?


    • #17
      multiple queues


      rabbitmqctl list_queues consumers does list 2 however only one app is running. Is this a residual effect from another app on same queue or is declaring a queue along with an inbound channel redundant?

      I assume queue-names in the channel adapter is just a ref to an already declared queue.

      activemq was so much easier to manage than rabbitmq...


      • #18
        Unknown channel 3

        so now that I got through all that, I am now getting an unknown channel 3 error, and still getting 2 consumers per app.

        Is this a result of me just not knowing what I am doing or just the early stages of development and the implementation just not quite there?


        • #19
          I would say probably the former, since the implementation is near to final release, but if there are really problems then we'd like to get more detailed feedback now (e.g. a stack trace on that error). Can you post your configuration? Still looks to me like you have another consumer process running somewhere. It works pretty seamlessly for others, and I don't think there is such a big learning curve if you are au fait with messaging in general. Most people say how easy it is to set up compared to ActiveMQ, so the contrast is interesting.


          • #20

            I am almost positive it is my fault but I had not problems with JMS/ActiveMQ for some reason this rabbit stuff is throwing me for a loop

            here is my config:
            <?xml version="1.0" encoding="UTF-8"?>
            <beans xmlns=""

            <!-- RabbitMQ -->
            <bean id="cf" class="org.springframework.amqp.rabbit.connection. SingleConnectionFactory">
            <constructor-arg value="localhost"/>
            <property name="Username" value="guest"/>
            <property name="Password" value="guest"/>
            <bean id="rabbitTemplate" class="org.springframework.amqp.rabbit.core.Rabbit Template">
            <property name="connectionFactory">
            <ref bean="cf"/>
            <property name="exchange" value="executions"/>
            <bean id="messageSender" class="com.trendfx.fixclient.amqp.ExecutionProduce r">
            <property name="Template">
            <ref bean="rabbitTemplate"/>
            <bean id="adminSender" class="com.trendfx.fixclient.amqp.AdminProducer">
            <property name="Template">
            <ref bean="rabbitTemplate"/>
            <rabbit:admin id="amqpAdmin" connection-factory="cf"/>
            <rabbit:queue name="queue.trades" durable="true"/>

            <bean id="TradeChannel" class=" ueChannel"/>
            <amqp:inbound-channel-adapter queue-names="queue.trades"
            <amqp:outbound-channel-adapter channel=""/>

            <!-- Hibernate -->
            <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="com.mysql.jdbc.Driver" />
            <property name="url" value="jdbc:mysql://localhost/**********" />
            <property name="username" value="*********r" />
            <property name="password" value="**********" />
            <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
            <property name="dataSource" ref="myDataSource" />
            <property name="mappingResources">
            <property name="hibernateProperties">
            hibernate.dialect=org.hibernate.dialect.MySQL5Inno DBDialect
            <bean id="fixclientDao" class="com.trendfx.fixclient.dao.FixclientDaoImpl"
            init-method="Start" destroy-method="Stop">
            <property name="sessionFactory" ref="mySessionFactory"/>
            <property name="ExecutionProducer" ref="messageSender"/>

            <!-- QuickFixJ -->
            <bean id="sessionSettings" class="quickfix.SessionSettings">
            <constructor-arg value="/home/bobby/MirageFX/MirageFix/mbtdemo.fix" />
            <bean id="fileStoreFactory" class="quickfix.FileStoreFactory">
            <constructor-arg ref="sessionSettings"/>
            <bean id="LogFactory" class="quickfix.FileLogFactory">
            <constructor-arg ref="sessionSettings"/>
            <bean id="messageFactory" class="quickfix.DefaultMessageFactory"/>
            <bean id="fixApplication" class="com.trendfx.fixclient.implementations.MbtCl ient">
            <property name="Sender" value="*************"/>
            <property name="Target" value="*************"/>
            <property name="FixclientDaoImpl" ref="fixclientDao"/>
            <bean id="socketInitiator" class="quickfix.SocketInitiator">
            <constructor-arg index="0" ref="fixApplication" />
            <constructor-arg index="1" ref="fileStoreFactory" />
            <constructor-arg index="2" ref="sessionSettings" />
            <constructor-arg index="3" ref="LogFactory" />
            <constructor-arg index="4" ref="messageFactory" />

            <bean id="basicChecks" class="com.trendfx.fixclient.risk.BasicChecks"
            init-method="Start" destroy-method="Stop">
            <property name="sessionFactory" ref="mySessionFactory"/>

            <bean id="fixSession" class="com.trendfx.fixclient.util.FixSession">
            <!-- init-method="Start" destroy-method="Stop"> -->
            <property name="fixApplication" ref="fixApplication" />
            <property name="socketInitiator" ref="socketInitiator" />
            <property name="basicChecks" ref="basicChecks" />

            <bean class="org.springframework.amqp.rabbit.listener.Si mpleMessageListenerContainer">
            <property name="ConnectionFactory" ref="cf"/>
            <property name="QueueNames" value="TradeMessages"/>
            <property name="MessageListener" ref="fixSession"/>

            <rabbit:listener-container connection-factory="cf">
            <rabbit:listener queues="queue.trades" ref="fixSession"/>


            • #21
              i suspect I need an outbound channel for my return messaging?


              • #22
                I can see immediately that you have 2 consumers on the queue.trades queue (one <rabbit:listener-container/> and one <amqp:inbound-channel-adapter/>), so that explains that observation. I'm not quite sure what you expect the Spring Integration pieces to do, since there are no endpoints attached to the TradeChannel (in this snippet at least), and the <amqp:outbound-channel-adapter channel=""/> is connected to nothing (I don't even know why that's legal). Maybe you don't need any of the Spring Integration pieces at all for your use case?

                P.S. don't use SingleConnectionFactory - the docs are quite clear about that, I hope.


                • #23

                  Thanks for the response. The only reason that I tried the integration was because I kept getting the unknown channel errors, everything was working fine but they were just annoying. I am still unclear what the spring integration piece is for? And what the channels are for then. It seems like the channels are for threading but I would think there would be a default channel. Obviously I am missing something major...


                  • #24
                    I would recommend reading the Spring Integration user guide if you are interested in that piece. You don't need it to use Spring AMQP, but some people find it useful, so that's why there is that spring-integration-amqp module for adapting Spring AMQP to the Spring Integration model. There's a close parallel with JMS there.

                    Spring Integration has a MessageChannel interface and AMQP has a Channel (clash of domain terminology, not related), so maybe that has caused some confusion in your case? "Unknown Channel" is what the AMQP broker will send you as an error message if you try and ack a message on a Channel that is closed (for instance). Why it would be closed is an open question, and it could happen for any number of reasons, like your network connection going down for instance. It wouldn't happen on a sunny day, though, and if you use a CachingConnectionFactory you might even find that it reconnects more cleanly.


                    • #25
                      one more error

                      I hate to come back but having another config related error. This is the last missing piece of my whole app. I am trying to produce to a fanout exchange. This is my amqp/rabbit related config:

                      <bean id="cf"
                      class="org.springframework.amqp.rabbit.connection. CachingConnectionFactory">
                      <constructor-arg value="localhost" />
                      <property name="Username" value="guest" />
                      <property name="Password" value="guest" />
                      <bean id="rabbitTemplate" class="org.springframework.amqp.rabbit.core.Rabbit Template">
                      <property name="connectionFactory">
                      <ref bean="cf" />
                      <property name="exchange" value="fx.quotes"/>
                      <property name="messageConverter">
                      <bean class=" JsonMessageConverter"/>
                      <bean id="messageSender" class="com.trendfx.rateclient.amqp.TopicProducer">
                      <property name="Template">
                      <ref bean="rabbitTemplate" />

                      when I try my rabbitTamplate.convertAndSend()

                      I am getting the following error:
                      15:40:38 ERROR [TopicProducer] java.lang.IllegalAccessError: tried to access method com.rabbitmq.client.impl.AMQBasicProperties.<init> ()V from class sagePropertiesConverter

                      I do not see anything in the spring doc about message properties so I am stuck
                      I thought it was a version issue and have tried the newest release (1.0.0.RC2) and 1.0.0.BUILD-SNAPSHOT. I am at a loss as to how to proceed.



                      • #26
                        Could you open a new issue in JIRA for this one? I will try to reproduce it.



                        • #27
                          version issue

                          Again I would bet this is more to do with my abilities than a general problem. I was trying different combinations of version for both spring-amqp and spring-rabbit. I did however create a JIRA bug


                          • #28
                            I think you have an older version of spring-rabbit on your classpath (maybe the snapshot is mouldy?). We haven't used BasicProperties() since before RC2 (see JIRA AMQP-175) because it was made private and replaced by a Builder pattern in the Rabbit Java client version 2.5.0.


                            • #29

                              I was thinking this yesterday. Should I even use spring-rabbit? If so which version? I tried to removed the spring-rabbit dependency but it also seems to remove the amqp-client-2.5.0.jar. I cannot seem to isolate it.


                              • #30
                                You should use spring-rabbit (likely 1.0.0.RC2) and simply rely on it to pull in the others transitively. Those would include not only the amqp-client but also spring-amqp.