Announcement Announcement Module
Collapse
No announcement yet.
Splitter to file outbound gateway- question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Splitter to file outbound gateway- question

    Hi,

    The splitter builds a set containing two Message's with strings stored in it and returns the set. The output is going to a file outbound gateway, and it is supposed to write two files out on to the directory. But only one file gets created.

    1) Looking at the message headers, the id and jms_message_id seem to be same for both is that the reason it creates just one file ?

    2) Just a minor thing, why it is called jms_message when im using a file based outbound gateway?

    I'm pasting the header information for more information.

    Thanks
    Srinivas


    Message1 header:
    [Headers={$id=2bc60b7c-0b0f-4709-baed-71cebbf67e7f, $jms_messageId=ID:<620136.1266505593729.0>, $jms_redelivered=false, $file_name=ceo100004271_090642245100218_1.csv, FILE_TRANSPORT_MODE=NOOP, JMS_BEA_RedeliveryLimit=1, history=[[name=outgoingWireFilterChannel;type=channel;timest amp=1266505593792], [name=org.springframework.integration.filter.Messag eFilter@824949;type=endpoint;timestamp=12665055937 92], [name=outgoingWireTransformChannel;type=channel;tim estamp=1266505598198], [name=org.springframework.integration.transformer.M essageTransformingHandler@824944;type=endpoint;tim estamp=1266505598198], [name=outgoingWiresChannel;type=channel;timestamp=1 266505602245], [name=org.springframework.integration.splitter.Meth odInvokingSplitter@8285e8;type=endpoint;timestamp= 1266505602245]], $timestamp=1266505593792, JMSXDeliveryCount=1}]

    Message 2 header:
    [Headers={$id=2bc60b7c-0b0f-4709-baed-71cebbf67e7f, $jms_messageId=ID:<620136.1266505593729.0>, $jms_redelivered=false, $file_name=ctpx.090642167100218.txt, FILE_TRANSPORT_MODE=NDM, JMS_BEA_RedeliveryLimit=1, history=[[name=outgoingWireFilterChannel;type=channel;timest amp=1266505593792], [name=org.springframework.integration.filter.Messag eFilter@824949;type=endpoint;timestamp=12665055937 92], [name=outgoingWireTransformChannel;type=channel;tim estamp=1266505598198], [name=org.springframework.integration.transformer.M essageTransformingHandler@824944;type=endpoint;tim estamp=1266505598198], [name=outgoingWiresChannel;type=channel;timestamp=1 266505602245], [name=org.springframework.integration.splitter.Meth odInvokingSplitter@8285e8;type=endpoint;timestamp= 1266505602245]], $timestamp=1266505593792, JMSXDeliveryCount=1}]

  • #2
    From what i could figure out so far, there is an exception in the downstream reply channel this gateway is configured to. this leads another question , why would the file created via gateway locally get deleted for exception?

    Comment


    • #3
      It would be helpful if you could provide some configuration excerpts. Specifically, I'd like to understand how the outbound-gateway is supposed to write two files, and I would like to understand what you mean by saying that a File is being *deleted* after an Exception.

      Comment


      • #4
        Sorry should have given more details

        Here is a snippet with details
        The transformation does transformation
        <int:channel id="outTransformChannel"/>
        <int:transformer ref="outFilterTransformer"
        input-channel="outTransformChannel"
        output-channel="outChannel" />

        The splitter prepares a Set with Two messages, each message has a string as the payload and some header information
        <int:channel id="outChannel"/>
        <int:splitter ref="outSplitter"
        method="splitXXX"
        input-channel="outChannel"
        output-channel="outFileChannel"/>

        The output from splitter , should send each message to the gateway. The gateway is expected to create a file for each message it retrieves. In this case my test has two messages and it should create two files?

        <int:channel id="outFileChannel"/>
        <int-file:outbound-gateway request-channel="outFileChannel"
        reply-channel="outFileCopier"
        directory="file:/tmp/intg/wire/"/>

        File copier is supposed to do local to remote copying.. currently this is not doing anything
        <int:channel id="outFileCopier"/>
        <int:service-activator input-channel="outFileCopier" output-channel="outRoutingChannel">



        <bean class="OutFileCopier"/>
        </int:service-activator>

        The copier also identifies where this file needs to be sent via this routing channel

        <int:header-value-router input-channel="outRoutingChannel" header-name="FILE_TRANSPORT_MODE"/>

        this is where a null pointer exception occurs,
        <int:channel id="NOOP"/>
        <int:service-activator input-channel="NDM">
        <bean class="OutNdmSender"/>
        </int:service-activator>

        Finally when i look at the tmp folder i just see one file, too complex?

        Comment


        • #5
          I see two times the same message in your original post, you have manually labeled them Message 1 and Message 2, but the ids are identical. It would be great if you could share the code of a small project that doesn't behave like you expected.

          Comment


          • #6
            If you notice, the headers point to different file names. Not sure having same message Id is the main cause. But they are two different messages.

            I'm attaching some simple POC to show you the issue.
            OutgoingTest -> can be used to run the test file.
            OutgoingNdmSender -> forces a null pointer. This forces the gateway somehow to create one file. If you comment out the throw exception line, you will see it creates two files in the /tmp/test folder

            Please let me know any details or if you have questions

            Comment

            Working...
            X