You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Nicky Sandhu <ka...@gmail.com> on 2007/10/01 18:51:01 UTC

Callback on Exchange for closing out streams, result set cursors

Hi folks,
 I see a number of commits based on async callback discussion
(http://www.nabble.com/Asynchronous-Exchange-Processing-t4313758s22882.html).
I am wondering if it applies to this usecase as well.
 For stream oriented or cursor oriented message bodies it is necessary to
have a callback so that cleanup such as closing out the
stream/resource/cursor can be done...else there would be leaks.
 So if a process does something like
 process(new Processor(){...
    ResourceStream stream;
    process(Exchange ex){ 
      setBody(stream = new ResourceStream());
      .....
    }
    onComplete(){
       closeStream();
    }
    onFailure(){
       closeStream();
    }
});

  Any chance this kinda support is going to be able to make it to 1.2
release ?
-- 
View this message in context: http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12982891
Sent from the Camel - Development mailing list archive at Nabble.com.


Re: Callback on Exchange for closing out streams, result set cursors

Posted by Nicky Sandhu <ka...@gmail.com>.
Yes, wrapping is an option but the code creating and closing the resource are
probably not colocated.

I just looked at the UnitOfWork and it seems to be right on. It seems to be
related to the AsyncCallback concepts.

The done status on an exchange would have to be supported at the Exchange
level to pull this off. So I guess I'll wait for James to finish this off.



gnodet wrote:
> 
> For streams, one way would be to wrap the stream and do some
> processing when the stream is actually closed.  In a general case,
> James had introduced the concept of UnitOfWork on the exchange, but
> the implementation is not finished.   It seems as if you're looking
> for the concept of the done status in JBI.
> 
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a13001281
Sent from the Camel - Development mailing list archive at Nabble.com.


Re: Callback on Exchange for closing out streams, result set cursors

Posted by Guillaume Nodet <gn...@gmail.com>.
For streams, one way would be to wrap the stream and do some
processing when the stream is actually closed.  In a general case,
James had introduced the concept of UnitOfWork on the exchange, but
the implementation is not finished.   It seems as if you're looking
for the concept of the done status in JBI.

On 10/2/07, Nicky Sandhu <ka...@gmail.com> wrote:
>
> Hi Hiram,
>  You have it right. I want to close it when the exchange completes. Is there
> a way to signal this? a callback perhaps?
>  For example in a producer is process(Exchange ex) method: to be able to
> either commit or rollback depending upon whether the exchange exception is
> null or not after the routing rules for that exchange have been processed.
>
>
> Hiram Chirino wrote:
> >
> > Hi Nicky,
> >
> > In your use case, it looks like you want to write a processor that
> > attaches a resource to the exchange that should not be closed by the
> > time the process() call finishes.. It should get closed when the
> > exchange completes.  Is this correct?
> >
> > Regards,
> > Hiram
> >
> > On 10/1/07, Nicky Sandhu <ka...@gmail.com> wrote:
> >>
> >> Hi folks,
> >>  I see a number of commits based on async callback discussion
> >> (http://www.nabble.com/Asynchronous-Exchange-Processing-t4313758s22882.html).
> >> I am wondering if it applies to this usecase as well.
> >>  For stream oriented or cursor oriented message bodies it is necessary to
> >> have a callback so that cleanup such as closing out the
> >> stream/resource/cursor can be done...else there would be leaks.
> >>  So if a process does something like
> >>  process(new Processor(){...
> >>     ResourceStream stream;
> >>     process(Exchange ex){
> >>       setBody(stream = new ResourceStream());
> >>       .....
> >>     }
> >>     onComplete(){
> >>        closeStream();
> >>     }
> >>     onFailure(){
> >>        closeStream();
> >>     }
> >> });
> >>
> >>   Any chance this kinda support is going to be able to make it to 1.2
> >> release ?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12982891
> >> Sent from the Camel - Development mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Regards,
> > Hiram
> >
> > Blog: http://hiramchirino.com
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12992505
> Sent from the Camel - Development mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Callback on Exchange for closing out streams, result set cursors

Posted by Nicky Sandhu <ka...@gmail.com>.
Hi Hiram, 
 You have it right. I want to close it when the exchange completes. Is there
a way to signal this? a callback perhaps?
 For example in a producer is process(Exchange ex) method: to be able to
either commit or rollback depending upon whether the exchange exception is
null or not after the routing rules for that exchange have been processed.
 

Hiram Chirino wrote:
> 
> Hi Nicky,
> 
> In your use case, it looks like you want to write a processor that
> attaches a resource to the exchange that should not be closed by the
> time the process() call finishes.. It should get closed when the
> exchange completes.  Is this correct?
> 
> Regards,
> Hiram
> 
> On 10/1/07, Nicky Sandhu <ka...@gmail.com> wrote:
>>
>> Hi folks,
>>  I see a number of commits based on async callback discussion
>> (http://www.nabble.com/Asynchronous-Exchange-Processing-t4313758s22882.html).
>> I am wondering if it applies to this usecase as well.
>>  For stream oriented or cursor oriented message bodies it is necessary to
>> have a callback so that cleanup such as closing out the
>> stream/resource/cursor can be done...else there would be leaks.
>>  So if a process does something like
>>  process(new Processor(){...
>>     ResourceStream stream;
>>     process(Exchange ex){
>>       setBody(stream = new ResourceStream());
>>       .....
>>     }
>>     onComplete(){
>>        closeStream();
>>     }
>>     onFailure(){
>>        closeStream();
>>     }
>> });
>>
>>   Any chance this kinda support is going to be able to make it to 1.2
>> release ?
>> --
>> View this message in context:
>> http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12982891
>> Sent from the Camel - Development mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Regards,
> Hiram
> 
> Blog: http://hiramchirino.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12992505
Sent from the Camel - Development mailing list archive at Nabble.com.


Re: Callback on Exchange for closing out streams, result set cursors

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Hi Nicky,

In your use case, it looks like you want to write a processor that
attaches a resource to the exchange that should not be closed by the
time the process() call finishes.. It should get closed when the
exchange completes.  Is this correct?

Regards,
Hiram

On 10/1/07, Nicky Sandhu <ka...@gmail.com> wrote:
>
> Hi folks,
>  I see a number of commits based on async callback discussion
> (http://www.nabble.com/Asynchronous-Exchange-Processing-t4313758s22882.html).
> I am wondering if it applies to this usecase as well.
>  For stream oriented or cursor oriented message bodies it is necessary to
> have a callback so that cleanup such as closing out the
> stream/resource/cursor can be done...else there would be leaks.
>  So if a process does something like
>  process(new Processor(){...
>     ResourceStream stream;
>     process(Exchange ex){
>       setBody(stream = new ResourceStream());
>       .....
>     }
>     onComplete(){
>        closeStream();
>     }
>     onFailure(){
>        closeStream();
>     }
> });
>
>   Any chance this kinda support is going to be able to make it to 1.2
> release ?
> --
> View this message in context: http://www.nabble.com/Callback-on-Exchange-for-closing-out-streams%2C-result-set-cursors-tf4549498s22882.html#a12982891
> Sent from the Camel - Development mailing list archive at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com