Results 1 to 3 of 3

Thread: dynamic reader

  1. #1
    Join Date
    Dec 2009
    Location
    Rabat,Morocco
    Posts
    3

    Default dynamic reader

    Greetings all

    How can I define a dynamic readers in my context application

    I tried to do some thing like :
    <chunk reader="#{jobParameters[reader]}" processor="processor" writer="compositewriter">

    but it did not work,


    Any help will be much appreciated

    Abdel

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    The chunk provider has to be created before the step is started, so there is no way to bind the reader itself as late as that. You would have to write a wrapper that can be injected as the reader, but lazily initialize to resolve the late bound parameter value when it is used. It's pretty easy to do that - I think it would work just to create an delegating ItemReader wrapper in step scope and initialize it with the same expression you are using in your example.

  3. #3
    Join Date
    Dec 2009
    Location
    Rabat,Morocco
    Posts
    3

    Default

    Hi Dave

    Thank you for the reply
    I really did not understand well how to implement your idea

    But I did some think that fixed my problem (It is little bit far from what I was seeking)

    I made I reader switcher like :
    <chunk reader="switchReader" processor="myProcessor" writer="myWriter" >

    and then I implemented my own class in which I switch from reader to reader :
    <bean id="switchReader" class="...ItemReaderSwitcher">
    </bean>

    and It worked


    Is that what you wanted me to do ?


    thanks in advance

    Abdel

Posting Permissions

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