1
votes

Hi I am using a Spring Integration project to connect to IBM MQ.Below is the code for the connectionFactory and 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>

I am using the above queue as destination queue

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

The Broker is up and channel is up also.I have used ChannelInterceptor for the input channel of the jms adapter and logged the jms message to be sent on the presend method and its coming successfully but the message is not getting transmitted to the queue itself.Also I have checked with the same connection factory and same queue details in some other flow and there message is getting transmitted. The current flow in which this message transmission is not working is given below

<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

1 Answers

0
votes

I suggest you turn on debug logging for org.springframework follow the message through the flow, as well as logs from the JmsTemplate used within the adapter.