Results 1 to 7 of 7

Thread: file:inbound-channel-adapter

  1. #1

    Default file:inbound-channel-adapter

    I'm trying to use the file:inbound-channel-adapter and I'm getting the following error:

    Clearly I'm not understanding something.

    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'filesIn': Invocation of init method failed; nested excep\
    tion is java.lang.IllegalArgumentException: No poller has been defined for channel-adapter 'filesIn', and no default poller is available within the context.

    Im using 1.0.3 but I also tried this in 1.0.2. Here is what my context file looks like

    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:integration="http://www.springframework.org/schema/integration"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:jms="http://www.springframework.org/schema/integration/jms"
    xmlns:file="http://www.springframework.org/schema/integration/file"
    xmlns:si-xml="http://www.springframework.org/schema/integration/xml"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schem...ontext-2.5.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schem...ration-1.0.xsd
    http://www.springframework.org/schema/integration/jms
    http://www.springframework.org/schem...on-jms-1.0.xsd
    http://www.springframework.org/schema/integration/xml
    http://www.springframework.org/schem...on-xml-1.0.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schem...g-util-2.5.xsd
    http://www.springframework.org/schem...gration/stream
    http://www.springframework.org/schem...stream-1.0.xsd
    http://www.springframework.org/schema/integration/file
    http://www.springframework.org/schema/integration/file/spring-integration-file-1.0.xsd">

    <file:inbound-channel-adapter id="filesIn"
    directory="file:/opt/ads/test-data"
    channel="incomingDcgsaFilesChannel" />
    <channel
    id="incomingDcgsaFilesChannel">
    <integration:interceptors>
    <beans:ref
    bean="interceptorMessageReceivedBean" />
    <beans:ref
    bean="interceptorEchoBean" />
    </integration:interceptors>
    </channel>

    <service-activator
    input-channel="incomingDcgsaFilesChannel"
    ref="doNothingServiceActivator" />
    </beans:beans>

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Since the file inbound-channel-adapter is a Polling Consumer, it requires a <poller/> sub-element. The comment about "default" poller is the other option: a single top-level <poller/> element may be defined with a "default" attribute value of "true". Such a default poller will be globally available for any Polling Consumer that does not provide its own explicit <poller/> sub-element.

    See this section of the reference manual for more detail:
    http://static.springsource.org/sprin...oint-namespace

    Hope that helps.

  3. #3
    Join Date
    Sep 2010
    Posts
    22

    Default Trouble using jms:inbound-channel-adapter

    I'm having trouble using the jms:inbound-channel-adapter
    I have implemented the channel adapter the same way it is specified in the Spring Integration Reference, using a poller:
    <jms:inbound-channel-adapter id="jmsIn" destination="inQueue" channel="exampleChannel">
    <integrationoller>
    <integration:interval-trigger interval="2" time-unit="SECONDS"/>
    </integrationoller>
    </jms:inbound-channel-adapter>

    The thing is that some messages remain in the queue and are not dequeued.
    It seems as new messages push old ones, but never all messages get out of the queue.
    Do you have an idea of why this could happen?
    I'm using a stand alone installation of active-mq and I'm watching the messages behaviour through the active-mq console.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Is that the only consumer process and is there only one instance running?

    You might want to disable the 'prefetch' which ActiveMQ does with a very aggressive default value (1000 for Queues I believe).

  5. #5
    Join Date
    Sep 2010
    Posts
    22

    Default Trouble using jms:inbound-channel-adapter

    I have one process consuming and one instance running.
    For some reason I don't know the active-mq console increments the number of consumers for the queues.
    I will try your suggestion.
    Thanks for your answer.

  6. #6
    Join Date
    Sep 2010
    Posts
    22

    Default

    I had this configuration
    Code:
    <beans:bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    Code:
    <beans:property name="targetConnectionFactory">
    Code:
    <beans:bean class="org.apache.activemq.ActiveMQConnectionFactory">
    Code:
    <beans:property name="brokerURL" value="tcp://localhost:61616"/>
    Code:
    </beans:bean>
    Code:
    </beans:property>
    Code:
    <beans:property name="sessionCacheSize" value="10" />
    Code:
    <beans:property name="cacheProducers" value="false" />
    Code:
    </beans:bean>
    Adding this line seems to have solved the problem
    Code:
    <beans:property name="cacheConsumers" value="false" />
    Last edited by juanemc2; Sep 8th, 2010 at 01:26 PM. Reason: better understanding

  7. #7
    Join Date
    Sep 2010
    Posts
    22

    Default Trouble using jms:inbound-channel-adapter

    I thought I had resolved the problem using
    Code:
    <beans:property name="cacheConsumers" value="false" />
    but it seems to change the behaviour of the jms:inbound-channel-adapter to the one of the jms:message-driven-channel-adapter.
    The poller interval is ignored, and messages just pass through the jms queue.

    Apart from this, I couldn't try to disable the 'prefetch' of ActiveMQ because I don't know where to set this property.

    Thanks in advance,
    juanemc2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •