Six Stars

How to read messages in batches from tMomInput?

I am using TOS 5.6.1. I want to read messages in batches from tMomInput and write it into a file. The max. number of messages in each file should be 25. Could someone please give me some suggestion?

I am able to read one message at a time, but not in batches. Thanks.

 

 

6 REPLIES
Moderator

Re: How to read messages in batches from tMomInput?

Hello,

So far, there is no "use batch size" in tMomXXX components. Feel free to create a new feature jira issue of DI project on talend bug tracker.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: How to read messages in batches from tMomInput?

Hi Sabrina, thanks for your reply. I tried to achieve this using tLoop as shown below. But since tMomMessageIdList has only "iterate" to connect to another component, when it goes to that iterate, its not coming back to the tLoop iterate. Is there any other way to pull messages from tMomInput as batches?

tLoop.GIF

Twelve Stars

Re: How to read messages in batches from tMomInput?

This is a "thinking outside the box" type solution, but I think this tutorial might help you. Instead of thinking about batching the request, think about batching the output. The tutorial below demonstrates how to write to a different file depending on the data being supplied.

https://www.rilhia.com/tutorials/load-data-dynamic-number-files

If you were to add some sort of sequence mechanism to your messages, you could quite easily write to a different file every time that sequence reached a max number of messages.

Rilhia Solutions
Six Stars

Re: How to read messages in batches from tMomInput?

Thanks for your help. I will check that out.

Twelve Stars

Re: How to read messages in batches from tMomInput?

Did this resolve your question? If so can you set it to resolved so that others can benefit from this?

Rilhia Solutions
Six Stars

Re: How to read messages in batches from tMomInput?

Thanks for your solution. But I got stuck and couldn't make this work. So for now I am sending one message at a time.