Apache camel 每次重新启动链接的JMS weblogic服务器时,驼峰JMS都会挂起

Apache camel 每次重新启动链接的JMS weblogic服务器时,驼峰JMS都会挂起,apache-camel,camel-jms,Apache Camel,Camel Jms,以下是我努力实现的目标: 从源目录中选择一个文件 将该文件复制到目标中 目录 将消息发布到weblogic队列,其中 不同的应用程序选择文件名并从 目标目录 问题是每次重新启动weblogic服务器时(由于代码部署),驼峰JMS路由都会挂起并停止工作,直到驼峰路由/Servicemix服务器重新启动 下面是我的骆驼路线代码: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframewo

以下是我努力实现的目标:

  • 从源目录中选择一个文件
  • 将该文件复制到目标中 目录
  • 将消息发布到weblogic队列,其中 不同的应用程序选择文件名并从 目标目录
  • 问题是每次重新启动weblogic服务器时(由于代码部署),驼峰JMS路由都会挂起并停止工作,直到驼峰路由/Servicemix服务器重新启动

    下面是我的骆驼路线代码:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:camel="http://camel.apache.org/schema/spring"
           xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    
        <!-- file name filter for Outgoing data file from weblogic -->
        <bean id="outFilter" class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter">
                <property name="includes" value="**/*TEST*.csv"/>
        </bean> 
    
        <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
            <property name="environment">
                <props>
                    <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                    <prop key="java.naming.provider.url">t3://<<servername>>:<<serverport>></prop>
                    <prop key="java.naming.security.principal">admin</prop>
                    <prop key="java.naming.security.credentials">admin123</prop>
                </props>
            </property>
        </bean>
    
        <bean id="jndiFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName"             value="weblogic.jms.ConnectionFactory"/>
            <property name="jndiTemplate"         ref="jndiTemplate"/>
            <property name="lookupOnStartup"     value="false"/>
            <property name="proxyInterface"     value="javax.jms.ConnectionFactory"/>
        </bean>
    
        <bean id="jndiDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
            <property name="jndiTemplate" ref="jndiTemplate"/>
        </bean>
    
        <bean id="jmsConfiguration" class="org.apache.camel.component.jms.JmsConfiguration">
            <property name="connectionFactory" ref="jndiFactoryBean"/>
            <property name="destinationResolver" ref="jndiDestinationResolver"/>
        </bean>
    
        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
            <property name="configuration" ref="jmsConfiguration" />
        </bean>
    
        <!-- Camel Context for WebLogic Environment -->
        <camelContext xmlns="http://camel.apache.org/schema/spring" id="weblogic-uat-camelcontext">
    
            <route id="testJMS">
                <from uri="file:///C:/input&amp;filter=#outFilter"/>
                <log message="File transfer begin"/>
                <doTry>
                    <to uri="file:///C:/output"/>
                    <setBody>  
                        <simple>${header.CamelFileName}</simple>  
                    </setBody>  
                    <log message="The message contains file name ${body}" />  
                    <to uri="jms:queue:jms/SampleQueue?jmsMessageType=Text"/>
                    <doCatch>
                        <exception>java.io.IOException</exception>
                        <handled>
                            <constant>false</constant>
                        </handled> 
                        <log message="{{file.transferFailedMessage}}"/>
                    </doCatch>            
                </doTry>
                <onCompletion onCompleteOnly="true">
                    <log message="File transfer complete"/>
                </onCompletion>
            </route>
    
        </camelContext>
    </beans>
    
    
    weblogic.jndi.WLInitialContextFactory
    t3://:
    管理
    管理员123
    ${header.CamelFileName}
    java.io.IOException
    假的
    

    Camel JMS中是否有一个属性/配置可以设置为处理JMS服务器的重新启动,以便Camel在每次重新启动时自动连接到weblogic队列?

    它可能更像是一个带有JMS队列连接工厂的JEE应用程序服务器配置,以及您使用的所有配置,以及使用JNDI进行查找。它可能有一些缓存设置、刷新设置或超时等。感谢克劳斯的输入。我们的servicemix以前在Windows操作系统上运行,最近我们将其迁移到RedHat Linux,之后问题就消失了。