Spring Integration: у Dispatcher нет подписчиков на канал - PullRequest
0 голосов
/ 16 мая 2019

Я пытаюсь создать приложение интеграции пружин, которое имеет следующую конфигурацию (виновник, кажется, канал xsltSpecific):

<beans:beans>   
    <channel id="channel1"></channel>
    <channel id="channel2"></channel>
    <channel id="xsltSpecific"></channel>
    <channel id="xsltSpecificDelayed"></channel>
    <channel id="xsltCommon"></channel>
    <channel id="irdSpecificUnmarshallerChannel"></channel>
    <channel id="irdSpecificInputChannel"></channel>

    <file:outbound-channel-adapter
        directory="${dml.ird.directory}" channel="channel1"
        auto-create-directory="true" filename-generator="timestampedFileNameGenerator">
    </file:outbound-channel-adapter>

    <recipient-list-router input-channel="fileChannel">
        <recipient channel="channel1" selector-expression="${dml.data.logs.enable}" />
        <recipient channel="channel2" />
    </recipient-list-router>
    <recipient-list-router input-channel="channel2">
        <recipient channel="xsltSpecificDelayed"></recipient>
        <recipient channel="xsltCommon"></recipient>
    </recipient-list-router>

    <delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>

    <jms:message-driven-channel-adapter
        id="jmsInboundAdapterIrd" destination="jmsInputQueue" channel="fileChannel"
        acknowledge="transacted" transaction-manager="transactionManager"
        error-channel="errorChannel" client-id="${ibm.jms.connection.factory.client.id}"
        subscription-durable="true" durable-subscription-name="${ibm.jms.subscription.id1}" />

    <si-xml:xslt-transformer input-channel="xsltCommon" output-channel="jmsInputChannel"
        xsl-resource="classpath:summit-hub-to-cpm-mapping.xsl" result-transformer="resultTransformer" >
    </si-xml:xslt-transformer>

    <si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
        xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
    </si-xml:xslt-transformer>

    <si-xml:unmarshalling-transformer id="irdUnmarshaller"
        unmarshaller="irdUnmarshallerDelegate" input-channel="irdSpecificUnmarshallerChannel"
        output-channel="saveSpecificTradeChannel" />

    <beans:bean id="irdUnmarshallerDelegate"
        class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <beans:property name="schema"
            value="summit-hub-specific.xsd" />
        <beans:property name="contextPath"
            value="com.h.i.c.d.i.mapping" />
    </beans:bean>

    <beans:bean id="resultTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />

    <service-activator ref="specificTradeService" input-channel="saveSpecificTradeChannel" 
        requires-reply="false" method="save"/>

    <file:inbound-channel-adapter directory="${dml.retry.directoryForIrd}"
        channel="fileChannelAfterRetry" auto-create-directory="true"
        prevent-duplicates="false" filename-regex=".*\.(msg|xml)" queue-size="50" >
        <poller fixed-delay="${dml.retry.delay}" max-messages-per-poll="50">
            <transactional transaction-manager="transactionManager" />
        </poller>
    </file:inbound-channel-adapter>

    <channel id="fileChannel"/>
    <channel id="fileChannelAfterRetry"/>

    <file:file-to-string-transformer
        input-channel="fileChannelAfterRetry" output-channel="fileChannel"
        delete-files="true" />

    <beans:import resource="classpath:cpm-dml-common-main.xml" />
</beans:beans>

Но у меня следующее исключение:

org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.GenericApplicationContext@6950e31.xsltSpecific'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers

Что означает это исключение? Кроме того, я не могу определить проблему, можете ли вы помочь мне решить эту проблему?

UPDATE

Извините, я не дал всего контекста ранее, потому что не думал, что это актуально. Исключение возникает во время теста, полученного из AbstractTransactionalJUnit4SpringContextTests, который закрывал контекст приложения в конце теста, прежде чем сообщение получило возможность добраться до конца. Я добавил Thread.sleep(10000) в конце теста, и исключение больше не происходит.

1 Ответ

2 голосов
/ 16 мая 2019

xsltSpecific - это просто значение по умолчанию DirectChannel с UnicastingDispatcher для доставки сообщений подписчикам канала.

В соответствии с вашей конфигурацией вы отправляете сообщение на этот канал с:

<delayer id="specificDelayer" input-channel="xsltSpecificDelayed" default-delay="5000" output-channel="xsltSpecific"/>

И, похоже, у вас действительно есть подписчик на этот канал:

<si-xml:xslt-transformer input-channel="xsltSpecific" output-channel="irdSpecificUnmarshallerChannel"
    xsl-resource="classpath:summit-hub-specific.xsl" result-transformer="resultTransformer" >
</si-xml:xslt-transformer>

Что на самом деле неясно, когда этот определенный абонент потерян. Не похоже, что у вас есть auto-startup="false" на этой конечной точке, но, с другой стороны, возможно, вы действительно остановите его во время выполнения ...

Не могли бы вы поделиться более подробной информацией по этому вопросу? Я хочу узнать, кто является исходящим абонентом для этого потерянного сообщения.

...