【发布时间】:2015-07-08 04:32:20
【问题描述】:
您好,我正在使用 Spring Integration 项目连接到 IBM MQ。下面是 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 -->
【问题讨论】: