使用camel amqp进行Camel RabbitMQ连接

时间:2016-07-08 12:14:44

标签: rabbitmq apache-camel amqp

我正在尝试使用camel-amqp(版本2.17)组件在我的骆驼路线中连接到rabbitmq。

我已将其配置如下:

@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;
    }

我得到的错误是

  

javax.jms.JMSException:强制关闭现有连接   远程主机   在   org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:66)   〜[qpid-JMS-客户0.8.0.jar:0.8.0]

在我的rabbitmq日志中,我可以看到以下消息,我无法理解

*

** 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}]}]]}}

*

我在rabbitmq中启用了amqp_1_0插件。 有人可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

这似乎是rabbitmq amqp 1.0插件中的一个错误。使用rabbitmq记录了一个问题。

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