Document flush

Hi,

I have a document list as input. each document contains two keys making them unique (say key1, key2). Now I have a publishable document list, and I have to map all input documents with same key1 (there would be more than one of them but the number wouldnt be fixed) to this publishable document and send it to the broker. What is the best way to do this .

Appreciate your help,
Thanks.
Vikas.

Following up on my prev mail (See below).
The way I am thinking of doing it is.

Loop through the input document list. Take each document. compare its key1 with the next documents key1. If it dosent match then publish the documentlist doc1. Then I need to somehow initialize doc1 so that I can populate it again from the 0th index and publish the second set. I am also attaching my first post.

I have a document list as input. each document contains two keys making them unique (say key1, key2). Now I have a publishable document list doc1, and I have to map all input documents with same key1 (there would be more than one of them but the number wouldnt be fixed) to doc1 and send it to the broker. What is the best way to do this .

Thanks,
vikas.