Spring Integration Jms出站通道适配器不向队列发送消息

时间:2015-04-29 04:31:26

标签: jms spring-integration

您好我正在使用Spring Integration项目连接到IBM MQ.Below是connectionFactory和Queue的代码

<bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
        <property name="hostName" value="${ibm.mq.connection.url}" />
        <property name="port" value="${ibm.mq.connection.port}" />
        <property name="transportType" value="1" />
        <property name="queueManager" value="${ibm.mq.conection.queuemanager}" />
        <property name="channel" value="${ibm.mq.conection.channel}" />
    </bean>

<bean id="asnShipConfirmQueue" class="com.ibm.mq.jms.MQQueue">
        <constructor-arg value="${ibm.mq.parcelMovement.ASNShipConfirm.queue}" />
    </bean>

我使用上面的队列作为目标队列

<int-jms:outbound-channel-adapter id="jmsOutAsnShipConfirm"
        channel="asnShipconfirmUpdateChannel" connection-factory="mqConnectionFactory"
        destination="asnShipConfirmQueue"/>

Broker已启动且通道也已启动。我已将ChannelInterceptor用于jms适配器的输入通道,并记录了要在presend方法上发送的jms消息,并且它已成功发送但消息未传输到队列本身。我也检查了相同的连接工厂和其他流程中的相同队列详细信息,并且消息正在传输。此消息传输不起作用的当前流程如下所示

<int:channel id="parcelMovementCreateLabelErrorChannel"></int:channel>

    <int:service-activator id="parcelMovementCreateLabelExceptionHandler"
        input-channel="parcelMovementCreateLabelErrorChannel" ref="ConnectErrorHandler"
        method="handleExceptionExposedServices">
    </int:service-activator>

    <int:channel id="httpCreateLabelRequestChannel" />
    <int:channel id="httpCreateLabelResponseChannel" />
    <int:channel id="validateCreateLabelRequestOutputChannel" />

    <int:channel id="printReturnLabelRequestChannel" />
    <int:channel id="printReturnLabelDbChannel" />
    <int:channel id="printReturnLabelReplyChannel" />
    <int:channel id="outJsonCreateLabelReplyChannel" />
    <int:channel id="invokeShippingLabelServiceInputChannel" />
    <int:channel id="invokeShippingLabelDbChannel" />
    <int:channel id="shippingLabelDbChannel" />
    <int:publish-subscribe-channel id="invokeShipConfirmXMLInputChannel" />
    <int:channel id="invokeShippingLabelResponseChannel"/>
    <int:channel id="asnShipconfirmUpdateChannel"/>
    <int:publish-subscribe-channel id="asnShipconfirmTransformerChannel"/>
    <int-http:inbound-gateway id="createLabel"
        request-channel="httpCreateLabeltRequestChannel" error-channel="parcelMovementCreateLabelErrorChannel"
        reply-channel="httpCreateLabelResponseChannel" supported-methods="POST"
        path="${parcelmovement.createLabel.url}">
        <int-http:header name="source" expression="#requestHeaders.source" />
        <int-http:header name="storeId" expression="#requestHeaders.storeId" />
        <int-http:header name="userId" expression="#requestHeaders.userId" />
        <int-http:header name="transactionId" expression="#requestHeaders.transactionId" />
        <int-http:header name="clientId" expression="#requestHeaders.clientId" />
        <int-http:header name="label" expression="#pathVariables.label" />
        <!-- <int-http:header name="id" expression="#requestParams.get('id')?:''" 
            /> -->
        <int-http:header name="oldParcelNumber" expression="#pathVariables.id" />
    </int-http:inbound-gateway>

    <int:service-activator id="validateCreateLabelRequest"
        input-channel="httpCreateLabeltRequestChannel" output-channel="validateCreateLabelRequestOutputChannel"
        ref="parcelMovementRequestValidatorService" method="validateCreateLabelRequest" />

    <int:header-value-router input-channel="validateCreateLabelRequestOutputChannel"
        header-name="labelType" default-output-channel="parcelMovementCreateLabelErrorChannel">
        <int:mapping value="RETURN_LABEL" channel="invokeReturnLabelServiceInputChannel" />
        <int:mapping value="SHIPPING_LABEL"
            channel="invokeShippingLabelServiceInputChannel" />
    </int:header-value-router>

    <int:service-activator id="printReturnLabel"
        input-channel="printReturnLabelRequestChannel" output-channel="printReturnLabelDbChannel"
        ref="parcelMovementRequestValidatorService" method="invokePrintReturnLabel" />

    <!--- Call store procedure to check pre-advice is already generated or not -->
    <int-jdbc:stored-proc-outbound-gateway
        id="printReturnLabelStoreProc" request-channel="printReturnLabelDbChannel"
        reply-channel="printReturnLabelReplyChannel" data-source="dataSource"
        is-function="false" ignore-column-meta-data="true"
        stored-procedure-name="${sp.parcelmovement.printReturnLabel}"
        expect-single-result="false">
        <int-jdbc:sql-parameter-definition
            name="V_OLD_PARCEL_NUMBER" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_RETURN_LABEL_NUMBER" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_USER_ID" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_STORE_ID" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="RESPONSE_CODE" direction="OUT" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="RESPONSE_MSG" direction="OUT" type="VARCHAR" />
        <int-jdbc:parameter name="V_OLD_PARCEL_NUMBER"
            expression="payload.oldParcelNumber" />
        <int-jdbc:parameter name="V_RETURN_LABEL_NUMBER"
            expression="payload.returnLabelNumber" />
        <int-jdbc:parameter name="V_USER_ID" expression="payload.userId" />
        <int-jdbc:parameter name="V_STORE_ID" expression="payload.originId" />
    </int-jdbc:stored-proc-outbound-gateway>

    <int:service-activator id="printReturnLabelReply"
        input-channel="printReturnLabelReplyChannel" ref="parcelMovementResponseService"
        method="createLabelResponse" output-channel="outJsonCreateLabelReplyChannel">
    </int:service-activator>

    <int:object-to-json-transformer
        input-channel="outJsonCreateLabelReplyChannel" output-channel="httpCreateLabelResponseChannel"></int:object-to-json-transformer>

    <!-- Print Shipping Label Start -->

    <int:service-activator id="invokeShippingLabelService"
        input-channel="invokeShippingLabelServiceInputChannel" ref="parcelMovementRequestValidatorService"
        method="generateShippingLabelRequest" output-channel="createReturnLabelJsonRequest">
    </int:service-activator>

    <int:service-activator id="invokeShippingLabelDb"
        input-channel="invokeShippingLabelDbChannel" ref="parcelMovementRequestValidatorService"
        method="invokeShippingLabelDb" output-channel="shippingLabelDbChannel">
    </int:service-activator>

    <int-jdbc:stored-proc-outbound-gateway
        id="shippingLabelStoreProc" request-channel="shippingLabelDbChannel"
        reply-channel="invokeShipConfirmXMLInputChannel"
        data-source="dataSource" is-function="false" ignore-column-meta-data="true"
        stored-procedure-name="${sp.parcelmovement.createShippingLabelProc}"
        expect-single-result="false">
        <int-jdbc:sql-parameter-definition
            name="V_SLOT_LABEL" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_STORE_ID" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_SHIPPING_LABEL_NUMBER" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="V_USER_ID" direction="IN" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="TEMP_OUT" direction="OUT" type="#{T(oracle.jdbc.OracleTypes).ARRAY}"
            type-name="SHIPPING_LABEL_TBL" return-type="sqlReturnStructArrayShippingLabel" />
        <int-jdbc:sql-parameter-definition
            name="RESPONSE_CODE" direction="OUT" type="VARCHAR" />
        <int-jdbc:sql-parameter-definition
            name="RESPONSE_MSG" direction="OUT" type="VARCHAR" />
        <int-jdbc:parameter name="V_SLOT_LABEL" expression="payload.oldParcelNumber" />
        <int-jdbc:parameter name="V_STORE_ID" expression="payload.originId" />
        <int-jdbc:parameter name="V_SHIPPING_LABEL_NUMBER" expression="payload.returnLabelNumber" />
        <int-jdbc:parameter name="V_USER_ID" expression="payload.userId" />
    </int-jdbc:stored-proc-outbound-gateway>

    <bean id="sqlReturnStructArrayShippingLabel"
        class="org.springframework.data.jdbc.support.oracle.SqlReturnStructArray">
        <constructor-arg name="mapper" ref="shippingLabelMapper" />
    </bean>
    <bean id="shippingLabelMapper"
        class="com.asda.connect.parcelmovement.mapper.ShippingLabelMapper" />
    <int:service-activator id="invokeShipConfirmXML"
        input-channel="invokeShipConfirmXMLInputChannel" ref="parcelMovementRequestValidatorService"
        method="generateShipConfirmationXml" output-channel="invokeShippingLabelResponseChannel">
    </int:service-activator>

    <int:header-value-router input-channel="invokeShippingLabelResponseChannel"
        header-name="isASNShipConfirmRequired" default-output-channel="parcelMovementCreateLabelErrorChannel">
        <int:mapping value="NO" channel="invokeShippingLabelResponseChannel" />
        <!-- Should point to MQ -->
        <int:mapping value="YES"
            channel="asnShipconfirmTransformerChannel" />
    </int:header-value-router>

    <int-xml:marshalling-transformer id="parcelMovementAsnShippingEventMarshaller"
        input-channel="asnShipconfirmTransformerChannel" output-channel="asnShipconfirmUpdateChannel"
        marshaller="jaxbunmarshaller" result-transformer="resultTransformer" />
    <!-- Push XML to MQ -->
    <int-jms:outbound-channel-adapter id="jmsOutAsnShipConfirm"
        channel="asnShipconfirmUpdateChannel" connection-factory="mqConnectionFactory"
        destination="asnShipConfirmQueue"/>
    <int:bridge input-channel="asnShipconfirmTransformerChannel" output-channel="invokeShippingLabelResponseChannel"/>
    <int:service-activator id="invokeShippingLabelResponse"
        input-channel="invokeShippingLabelResponseChannel" ref="parcelMovementResponseService"
        method="createShippingLabelResponse" output-channel="outJsonCreateLabelReplyChannel">
    </int:service-activator>

<!-- Create Label END -->

1 个答案:

答案 0 :(得分:0)

我建议你打开org.springframework的调试日志记录,按照流程中的消息,以及适配器中使用的JmsTemplate的日志。