骆驼,带有Spring jndi模板的solace jndi配置不会在solace无法访问时抛出异常

我正在尝试使用camel-jms和spring连接到solace broker。而且我的微服务将使用REST输入并排入慰问队列。

我面临的问题是,当与慰藉的连接中断而不是抛出错误时,处理线程将无限期地等待连接建立。

在客户端调用REST服务时,就会超时。

春季配置:

     <bean id="Solace.JndiTemplateDev"
          class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.provider.url">smf://_url_:port</prop>
                <prop key="java.naming.factory.initial">com.solacesystems.jndi.SolJNDIInitialContextFactory</prop>
                <prop key="java.naming.security.principal">xxxx</prop>
                <prop key="java.naming.security.credentials">xxxxxx</prop>
                <prop key="Solace_JMS_JNDI_ConnectRetries">0</prop>
                <prop key="Solace_JMS_JNDI_ReadTimeout">10000</prop>
                <prop key="Solace_JMS_JNDI_ReconnectRetries">2</prop>
                <prop key="Solace_JMS_JNDI_ConnectTimeout">5000</prop>
            </props>
        </property>
    </bean>

    <bean id="Solace.JndiObjectFactoryBeanDev"
          class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="Solace.JndiTemplateDev"/>
        <property name="jndiName" value="defaultConnectionFactory"/>
        <property name="lookupOnStartup" value="false"/>
        <property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
    </bean>

    <bean id="Solace.CachedConnectionFactoryDev" primary="true"
          class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetconnectionFactory" ref="Solace.JndiObjectFactoryBeanDev"/>
        <property name="reconnectOnException" value="true"/> 
        <property name="sessionCacheSize" value="5"/>
    </bean>


    <bean id="dynamicDestinationResolverDev"
        class="org.springframework.jms.support.destination.DynamicDestinationResolver">
    </bean>

    <bean id="jmsSolaceBhPDEV" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="Solace.CachedConnectionFactoryDev"/>
        <property name="destinationResolver" ref="dynamicDestinationResolverDev"/>

    </bean>

请找到日志。

19.11.18 22:55:30.641 DEBUG     http-nio-8080-exec-3  com.solacesystems.jms.SolSession  qa | Entering createQueue()
19.11.18 22:55:30.643  INFO     http-nio-8080-exec-3 mp.protocol.impl.TcpClientChannel  qa | TcpClientChannel:open(isReconn=false) while connected,return.
19.11.18 22:55:30.644 DEBUG     http-nio-8080-exec-3 mp.protocol.impl.TcpClientChannel  qa | doSmfSharedReq (smfclient 4) try=0 / max=1 
19.11.18 22:55:48.937  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connection attempt failed to host 'abc.com' Reconnectexception com.solacesystems.jcsmp.JCSMPTransportException: (Client name: localhost/19108/#00560002/xnuvPhoyFH   Local port: -1   Remote addr: abc.com:55555) - Error communicating with the router. cause: java.net.connectexception: Connection timed out: no further information
19.11.18 22:55:51.939 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Closing socket
19.11.18 22:55:51.940  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connecting to host 'orig=tcp://abc.com:55555,scheme=tcp://,host=abc.com,port=55555' (host 1 of 1,smfclient 4,attempt 2 of 2147483647,this_host_attempt: 1 of 2)
19.11.18 22:55:51.941 DEBUG Thread_reconnect_service ocol.impl.ChannelOpStrategyClient  qa | [JCSMPSession[testErrorHandlerUser@tcp://abc.com:55555] (0002)] Opening TcpClientChannel.
19.11.18 22:55:51.943 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555Correlation tag not found in message,adding one: 13
19.11.18 22:55:51.944 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Attempting to open socket,port=55555
19.11.18 22:55:51.962  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connection attempt failed to host 'abc.com' Reconnectexception com.solacesystems.jcsmp.JCSMPTransportException: (Client name: localhost/19108/#00560002/xnuvPhoyFH   Local port: -1   Remote addr: abc.com:55555) - Error communicating with the router. cause: java.net.UnknownHostException
19.11.18 22:55:54.964 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Closing socket
19.11.18 22:55:54.966  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connecting to host 'orig=tcp://abc.com:55555,this_host_attempt: 2 of 2)
19.11.18 22:55:54.967 DEBUG Thread_reconnect_service ocol.impl.ChannelOpStrategyClient  qa | [JCSMPSession[testErrorHandlerUser@tcp://abc.com:55555] (0002)] Opening TcpClientChannel.
19.11.18 22:55:54.969 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555Correlation tag not found in message,adding one: 14
19.11.18 22:55:54.970 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Attempting to open socket,port=55555
19.11.18 22:55:54.972  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connection attempt failed to host 'abc.com' Reconnectexception com.solacesystems.jcsmp.JCSMPTransportException: (Client name: localhost/19108/#00560002/xnuvPhoyFH   Local port: -1   Remote addr: abc.com:55555) - Error communicating with the router. cause: java.net.UnknownHostException
19.11.18 22:55:57.975 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Closing socket
19.11.18 22:55:57.977  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connecting to host 'orig=tcp://abc.com:55555,attempt 3 of 2147483647,this_host_attempt: 1 of 2)
19.11.18 22:55:57.978 DEBUG Thread_reconnect_service ocol.impl.ChannelOpStrategyClient  qa | [JCSMPSession[testErrorHandlerUser@tcp://abc.com:55555] (0002)] Opening TcpClientChannel.
19.11.18 22:55:57.981 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555Correlation tag not found in message,adding one: 15
19.11.18 22:55:57.982 DEBUG Thread_reconnect_service csmp.protocol.smf.SimpleSmfClient  qa | Local port: -1   Remote addr: abc.com:55555(smfclient 4) Attempting to open socket,port=55555
19.11.18 22:55:57.983  INFO Thread_reconnect_service mp.protocol.impl.TcpClientChannel  qa | Connection attempt failed to host 'abc.com' Reconnectexception com.solacesystems.jcsmp.JCSMPTransportException: (Client name: localhost/19108/#00560002/xnuvPhoyFH   Local port: -1   Remote addr: abc.com:55555) - Error communicating with the router. cause: java.net.UnknownHostException
jjl249144301 回答:骆驼,带有Spring jndi模板的solace jndi配置不会在solace无法访问时抛出异常

似乎您已经在Solace侧的连接工厂中将connect retries属性配置为“ -1”。这将导致应用程序无限期重试。

在您的应用程序中,您为JNDI连接配置了适当的重新连接设置,但没有为数据连接配置

必须在连接工厂的Solace侧设置数据连接重新连接属性。 (https://docs.solace.com/Solace-JMS-API/Data-Connection-Properti.htm

本文链接:https://www.f2er.com/3078731.html

大家都在问