Announcement Announcement Module
Collapse
No announcement yet.
File adapter - Error - failed to send message to channel 'output' within timeout: -1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • File adapter - Error - failed to send message to channel 'output' within timeout: -1

    Hi All,

    I am a new bee to Spring Integration and using Spring 2.1.
    I am trying to implement the file adapter but getting the following error.

    My config.xml is ...

    <bean id="fileGen" class="com.ca.si.NewFileNameGenerator"></bean>

    <intublish-subscribe-channel id="input"></intublish-subscribe-channel>
    <intublish-subscribe-channel id="output"></intublish-subscribe-channel>

    <int-file:outbound-gateway auto-startup="true" id="fileGateway" directory="C:\\SINT1" request-channel="input" reply-channel="output" auto-create-directory="true" filename-generator="fileGen">

    </int-file:outbound-gateway>

    My Main Program is ...

    public class SpringSimpleMain {

    public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("spring-sample.xml");
    Object obj = context.getBean("input");
    PublishSubscribeChannel input = (PublishSubscribeChannel) obj;
    Message<String> str = new GenericMessage<String>("Spring integration");
    input.send(str);
    }

    }

    Error occured is ...
    Exception in thread "main" org.springframework.integration.MessageDeliveryExc eption: failed to send message to channel 'output' within timeout: -1
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:292)
    at org.springframework.integration.core.MessagingTemp late.send(MessagingTemplate.java:149)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendMessage(AbstractRep lyProducingMessageHandler.java:175)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:159)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.produceReply(AbstractRe plyProducingMessageHandler.java:124)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleResult(AbstractRe plyProducingMessageHandler.java:118)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:100)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:73)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.invokeHandler(BroadcastingDispatch er.java:120)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.dispatch(BroadcastingDispatcher.ja va:111)
    at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:77)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:157)
    at com.ca.si.SpringSimpleMain.main(SpringSimpleMain.j ava:16)

    Please help me in this regard.

    Thanks
    GNR
    Last edited by nrgodmala; Apr 26th, 2012, 12:01 AM.

  • #2
    Hello

    Let me guess: your <publish-subscribe-channel id="output"> doesn't have any subscribers.
    you should continue to configure your message flow.
    And one more advice: don't use Spring Integration API directly. Write simple POJI-gateway for sending message. And use it in your code.

    Cheers,
    Artem Bilan

    Comment


    • #3
      Hi AB,
      Thanks for replying to my question.
      I actually thought of implementing the following use case.
      I will send a message via an input channel and it should be recieved by an output channel and is saved to a file in a specified directory.
      I was able to do it via queues, but the program was not exiting as it was still polling the directory.
      So, I thought of using publish-subscribe, but got into this error.
      Could you please help

      Thanks
      GNR

      Comment


      • #4
        OK. Let it be!
        Can you show any endpoint, who has <publish-subscribe-channel id="output"> as his input-channel?

        Comment


        • #5
          I was assuming the
          <int-file:outbound-gateway auto-startup="true" id="fileGateway" directory="C:\\SINT1" request-channel="input" reply-channel="output" auto-create-directory="true" filename-generator="fileGen">

          the above code is serving for recieving input and sending output from channels.

          Thanks
          GNR

          Comment


          • #6
            Sorry for late reply.

            <int-file:outbound-gateway> uses reply-channel for sending result of FileWritingMessageHandler#handleRequestMessage (File object).
            So, I again insist: you should have some subscriber for <publish-subscribe-channel id="output">

            Comment

            Working...
            X