Results 1 to 4 of 4

Thread: [Spring Batch Integration] Writing to a channel

  1. #1
    Join Date
    Feb 2007
    Location
    Burlington, VT
    Posts
    9

    Default [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. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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).

  3. #3
    Join Date
    Feb 2007
    Location
    Burlington, VT
    Posts
    9

    Default

    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.

  4. #4
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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" />

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
  •