Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camel RabbitMQ connection using camel amqp

I am trying to connect to rabbitmq in my camel route using camel-amqp (version 2.17) component.

I have configured it as below :

@Bean
    CachingConnectionFactory jmsCachingConnectionFactory(){

        JmsConnectionFactory pool = new JmsConnectionFactory();
        pool.setRemoteURI("amqp://127.0.0.1:5672");
        pool.setUsername("guest");
        pool.setPassword("guest");

        CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
        cachingConnectionFactory.setTargetConnectionFactory(pool);
        return cachingConnectionFactory;
    }

    @Bean
    JmsConfiguration jmsConfig(){

        JmsConfiguration configuration = new JmsConfiguration();
        configuration.setConnectionFactory(jmsCachingConnectionFactory());
       // configuration.setCacheLevelName("CACHE_CONSUMER");
        return configuration;
    }

    @Bean
    AMQPComponent amqp(){
        AMQPComponent component = new AMQPComponent();
        component.setConfiguration(jmsConfig());
        return  component;
    }

The error I am getting is

javax.jms.JMSException: An existing connection was forcibly closed by the remote host at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:66) ~[qpid-jms-client-0.8.0.jar:0.8.0]

In my rabbitmq log I can see the below message which I am not able to understand

*

** Reason for termination == 
** {function_clause,
       [{rabbit_amqp1_0_link_util,'-outcomes/1-lc$^0/1-0-',
            [{list,
                 [{symbol,<<"amqp:accepted:list">>},
                  {symbol,<<"amqp:rejected:list">>},
                  {symbol,<<"amqp:released:list">>},
                  {symbol,<<"amqp:modified:list">>}]}],
            [{file,"src/rabbit_amqp1_0_link_util.erl"},{line,49}]},
        {rabbit_amqp1_0_link_util,outcomes,1,
            [{file,"src/rabbit_amqp1_0_link_util.erl"},{line,49}]},
        {rabbit_amqp1_0_outgoing_link,attach,3,
            [{file,"src/rabbit_amqp1_0_outgoing_link.erl"},{line,41}]},
        {rabbit_amqp1_0_session_process,with_disposable_channel,2,
            [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,377}]},
        {rabbit_amqp1_0_session_process,handle_control,2,
            [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,197}]},
        {rabbit_amqp1_0_session_process,handle_cast,2,
            [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,134}]},
        {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1049}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
=ERROR REPORT==== 8-Jul-2016::17:09:27 ===
closing AMQP connection <0.29082.0> (127.0.0.1:55479 -> 127.0.0.1:5672):
{handshake_error,running,<0.29104.0>,
    {{symbol,<<"amqp:internal-error">>},
     "Session error: ~p~n~p~n",
     [function_clause,
      [{rabbit_amqp1_0_link_util,'-outcomes/1-lc$^0/1-0-',
           [{list,
                [{symbol,<<"amqp:accepted:list">>},
                 {symbol,<<"amqp:rejected:list">>},
                 {symbol,<<"amqp:released:list">>},
                 {symbol,<<"amqp:modified:list">>}]}],
           [{file,"src/rabbit_amqp1_0_link_util.erl"},{line,49}]},
       {rabbit_amqp1_0_link_util,outcomes,1,
           [{file,"src/rabbit_amqp1_0_link_util.erl"},{line,49}]},
       {rabbit_amqp1_0_outgoing_link,attach,3,
           [{file,"src/rabbit_amqp1_0_outgoing_link.erl"},{line,41}]},
       {rabbit_amqp1_0_session_process,with_disposable_channel,2,
           [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,377}]},
       {rabbit_amqp1_0_session_process,handle_control,2,
           [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,197}]},
       {rabbit_amqp1_0_session_process,handle_cast,2,
           [{file,"src/rabbit_amqp1_0_session_process.erl"},{line,134}]},
       {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1049}]},
       {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]]}}

*

I have enabled amqp_1_0 plugin in rabbitmq. Can someone help me resolve this.

like image 686
VGaur Avatar asked Nov 09 '22 12:11

VGaur


1 Answers

This seems a bug in rabbitmq amqp 1.0 plugin. An issue has been logged with rabbitmq.

https://github.com/rabbitmq/rabbitmq-amqp1.0/issues/31

like image 106
VGaur Avatar answered Jan 04 '23 02:01

VGaur