Multiple records per file, call action once

3 messages Options
Embed this post
Permalink
Meikel Bode

Multiple records per file, call action once

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Hi all,

 

I am using OpenESB for the first time and it works great for me.

My process is realy simple:

 

1.       Poll local directory for new files to process.

2.       Handle every record inside the file as separate message

3.       Update an existing record in the database with information from the current file record.

 

Now I want to extend the process as follows:

 

For every file (NOT message) found in the working directory call a stored procedure.

 

The problem is, that I want to handle every record inside the files as separate message.

If I just add the additional step (call stored procedure) the existing process, the procedure will be called for every message (file record).

 

How can I call the stored procedure once per file and not once per record?

 

Thanks in advance!

 

Meikel

 



bil Consult Gesellschaft für betriebswirtschaftliche und informationstechnische Lösungen mbH

Sitz der Gesellschaft: Bielefeld
Geschäftsführer: Richard Hohmann-Damaschke, Dieter Steinberg, Thomas Topalidis
Amtsgericht Bielefeld - HRB 35606
Andreas Egloff

Re: Multiple records per file, call action once

Reply Threaded More More options
Print post
Permalink
One way you should be able to achieve this is to look at the message
group id and message id, i.e.

org.glassfish.openesb.messaging.groupid  
org.glassfish.openesb.messaging.messageid

Group ID represents your file (i.e. is generated from your file name),
the message id is a unique identifier within that group, for file the
message id is actually a sequence number of the record within the file.

So by looking at this sequence number (the message id) you can create an
if condition to only do something when the first record is encountered.

Does it matter when the stored procedure gets called, i.e. before the
records are processed? Do the messages need to be processed in order? If
you require either of these, you need to configure serial message
processing (setting maximum concurrency to 1 from the feeding file link).

BTW the above properties that any of our supported components generate
afaik are essentially the equivalent to the the below file binding
specific property names
org.glassfish.openesb.file.inbound.batchid
org.glassfish.openesb.file.inbound.recordnumber

HTH,
Andi

Meikel Bode wrote:

>
> Hi all,
>
>  
>
> I am using OpenESB for the first time and it works great for me.
>
> My process is realy simple:
>
>  
>
> 1.       Poll local directory for new files to process.
>
> 2.       Handle every record inside the file as separate message
>
> 3.       Update an existing record in the database with information
> from the current file record.
>
>  
>
> Now I want to extend the process as follows:
>
>  
>
> For every file (NOT message) found in the working directory call a
> stored procedure.
>
>  
>
> The problem is, that I want to handle every record inside the files as
> separate message.
>
> If I just add the additional step (call stored procedure) the existing
> process, the procedure will be called for every message (file record).
>
>  
>
> How can I call the stored procedure once per file and not once per
> record?
>
>  
>
> Thanks in advance!
>
>  
>
> Meikel
>
>  
>
>
> bil Consult Gesellschaft für betriebswirtschaftliche und
> informationstechnische Lösungen mbH
>
> Sitz der Gesellschaft: Bielefeld
> Geschäftsführer: Richard Hohmann-Damaschke, Dieter Steinberg, Thomas
> Topalidis
> Amtsgericht Bielefeld - HRB 35606


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Andreas Egloff

Re: Multiple records per file, call action once

Reply Threaded More More options
Print post
Permalink
One item to keep in mind is that there is an at-least-once delivery
guarantee by default. So if the system fails/crashes and it recovers it
will start going through the incomplete file again, so you would need to
be ok to re-do the processing for the whole file again.
Andi

Andreas Egloff wrote:

> One way you should be able to achieve this is to look at the message
> group id and message id, i.e.
>
> org.glassfish.openesb.messaging.groupid  
> org.glassfish.openesb.messaging.messageid
>
> Group ID represents your file (i.e. is generated from your file name),
> the message id is a unique identifier within that group, for file the
> message id is actually a sequence number of the record within the file.
>
> So by looking at this sequence number (the message id) you can create
> an if condition to only do something when the first record is
> encountered.
>
> Does it matter when the stored procedure gets called, i.e. before the
> records are processed? Do the messages need to be processed in order?
> If you require either of these, you need to configure serial message
> processing (setting maximum concurrency to 1 from the feeding file link).
>
> BTW the above properties that any of our supported components generate
> afaik are essentially the equivalent to the the below file binding
> specific property names
> org.glassfish.openesb.file.inbound.batchid
> org.glassfish.openesb.file.inbound.recordnumber
>
> HTH,
> Andi
>
> Meikel Bode wrote:
>>
>> Hi all,
>>
>>  
>>
>> I am using OpenESB for the first time and it works great for me.
>>
>> My process is realy simple:
>>
>>  
>>
>> 1.       Poll local directory for new files to process.
>>
>> 2.       Handle every record inside the file as separate message
>>
>> 3.       Update an existing record in the database with information
>> from the current file record.
>>
>>  
>>
>> Now I want to extend the process as follows:
>>
>>  
>>
>> For every file (NOT message) found in the working directory call a
>> stored procedure.
>>
>>  
>>
>> The problem is, that I want to handle every record inside the files
>> as separate message.
>>
>> If I just add the additional step (call stored procedure) the
>> existing process, the procedure will be called for every message
>> (file record).
>>
>>  
>>
>> How can I call the stored procedure once per file and not once per
>> record?
>>
>>  
>>
>> Thanks in advance!
>>
>>  
>>
>> Meikel
>>
>>  
>>
>>
>> bil Consult Gesellschaft für betriebswirtschaftliche und
>> informationstechnische Lösungen mbH
>>
>> Sitz der Gesellschaft: Bielefeld
>> Geschäftsführer: Richard Hohmann-Damaschke, Dieter Steinberg, Thomas
>> Topalidis
>> Amtsgericht Bielefeld - HRB 35606
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]