Announcement Announcement Module
Collapse
No announcement yet.
[Spring Batch Integration] Writing to a channel Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Spring Batch Integration] Writing to a channel

    I am trying to use Spring Batch & Integration in my current project. I have it set up so that when a file arrives on a channel it gets processed via a batch job. I then want the results of the job to be written back to another channel.

    I found ChunkMessageChannelItemWriter but I'm having trouble finding useful examples / docs. Any direction as to where to look for those also would be appreciated.

    Are there any other existing classes in Spring Batch Integration that can be supplied as a writer to a chunk and output items on a channel?

    Thanks!

  • #2
    I haven't really understood your use case. The ChunkMessageChannelItemWriter is mainly intended for use in a Remote Chunking pattern (there are samples / integration tests in the project at https://src.springframework.org/svn/...ch-integration).

    Comment


    • #3
      What I'm trying to accomplish is something like the following sudo-config where the writer for a chunk just writes items to a integration:channel.

      Code:
      <bean id="writer" class="????">
         <property name="output-channel" ref="outputChannel"/>
      </bean> 
      
      <batch:job id="processJob" job-repository="jobRepository">
          <batch:step id="parse">
             <batch:tasklet>
                 <batch:chunk reader="reader" writer="writer" commit-interval="100"/>
              </batch:tasklet>
          </batch:step>
      </batch:job>
      Does a writer which simply writes to a channel already exist? It's also possibly I'm not using spring batch integration correctly.

      Comment


      • #4
        Just use a gateway - it's a standard Spring Integration feature. From MessagingGatewayIntegrationTests-context.xml:

        Code:
        <integration:gateway service-interface="org.springframework.batch.item.ItemWriter" id="writer"	default-request-timeout="100" default-request-channel="inputs" />

        Comment

        Working...
        X