You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Lorenzo <ce...@gmail.com> on 2007/05/23 12:02:49 UTC

Save and load message before mediation

Hi all,

i'm trying to store messages with synapse, but i have some problems:

1) Save message:
	FileOutputStream fos = new FileOutputStream("MC.msg");
	ObjectOutputStream obj_out = new ObjectOutputStream (fos);
	obj_out.writeObject(mc);
	obj_out.close();
	fos.close(); 
2) Load message
	FileInputStream file_mc = new 
	FileInputStream("MC.msg");
	ObjectInputStream is_mc = new ObjectInputStream(file_mc);
	newmc = (MessageContext) is_mc.readObject();
3) Activate it
	mc.activate(confctx);

Now when i try to mediate it i get:
 Synapse received a new message for message mediation... 
 Received To: /SincronoAttachment/SincronoAttachment 
 SOAPAction: null 
 WSA-Action: null 
 Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org 

And i loose attachments (SOAP envelope is saved and correctly
restored).. 
Moreover when it receive the response i get this error:
 ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
send message 
 ERROR Axis2Sender - Unexpected error during Sending message back 
org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
send message


What i have to do to complete the message save/restore?

Thx!





---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by Lorenzo <ce...@gmail.com>.
No, for now i'm doing it into synapse messagereceiver saving and
restoring message context before inject. When it works i'll think which
is the best point to make the save.

Transport is http.



On mer, 2007-05-23 at 17:01 +0530, Asankha C. Perera wrote:
> Lorenzo
> 
> Are you using a class mediator to do this? also what is the transport 
> over which this message is received and subsequently sent back?
> 
> asankha
> 
> Paul Fremantle wrote:
> > Can you explain the scenario a little bit better? Seems like this
> > might be something really cool we could build into Synapse.
> >
> > Paul
> >
> > On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
> >> Hi all,
> >>
> >> i'm trying to store messages with synapse, but i have some problems:
> >>
> >> 1) Save message:
> >>         FileOutputStream fos = new FileOutputStream("MC.msg");
> >>         ObjectOutputStream obj_out = new ObjectOutputStream (fos);
> >>         obj_out.writeObject(mc);
> >>         obj_out.close();
> >>         fos.close();
> >> 2) Load message
> >>         FileInputStream file_mc = new
> >>         FileInputStream("MC.msg");
> >>         ObjectInputStream is_mc = new ObjectInputStream(file_mc);
> >>         newmc = (MessageContext) is_mc.readObject();
> >> 3) Activate it
> >>         mc.activate(confctx);
> >>
> >> Now when i try to mediate it i get:
> >>  Synapse received a new message for message mediation...
> >>  Received To: /SincronoAttachment/SincronoAttachment
> >>  SOAPAction: null
> >>  WSA-Action: null
> >>  Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org
> >>
> >> And i loose attachments (SOAP envelope is saved and correctly
> >> restored)..
> >> Moreover when it receive the response i get this error:
> >>  ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
> >> send message
> >>  ERROR Axis2Sender - Unexpected error during Sending message back
> >> org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
> >> send message
> >>
> >>
> >> What i have to do to complete the message save/restore?
> >>
> >> Thx!
> >>
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: synapse-user-help@ws.apache.org
> >>
> >>
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by "Asankha C. Perera" <as...@wso2.com>.
Lorenzo

Are you using a class mediator to do this? also what is the transport 
over which this message is received and subsequently sent back?

asankha

Paul Fremantle wrote:
> Can you explain the scenario a little bit better? Seems like this
> might be something really cool we could build into Synapse.
>
> Paul
>
> On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
>> Hi all,
>>
>> i'm trying to store messages with synapse, but i have some problems:
>>
>> 1) Save message:
>>         FileOutputStream fos = new FileOutputStream("MC.msg");
>>         ObjectOutputStream obj_out = new ObjectOutputStream (fos);
>>         obj_out.writeObject(mc);
>>         obj_out.close();
>>         fos.close();
>> 2) Load message
>>         FileInputStream file_mc = new
>>         FileInputStream("MC.msg");
>>         ObjectInputStream is_mc = new ObjectInputStream(file_mc);
>>         newmc = (MessageContext) is_mc.readObject();
>> 3) Activate it
>>         mc.activate(confctx);
>>
>> Now when i try to mediate it i get:
>>  Synapse received a new message for message mediation...
>>  Received To: /SincronoAttachment/SincronoAttachment
>>  SOAPAction: null
>>  WSA-Action: null
>>  Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org
>>
>> And i loose attachments (SOAP envelope is saved and correctly
>> restored)..
>> Moreover when it receive the response i get this error:
>>  ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
>> send message
>>  ERROR Axis2Sender - Unexpected error during Sending message back
>> org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
>> send message
>>
>>
>> What i have to do to complete the message save/restore?
>>
>> Thx!
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: synapse-user-help@ws.apache.org
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by "Asankha C. Perera" <as...@wso2.com>.

Paul Fremantle wrote:
>> Yes, but what's up if i receive 100 msg of 50 mb to route? (hope it
>> never happens :P but i have to consider it)
>
> Maybe Asankha will correct me, but Synapse should be forwarding
> messages in constant memory because of the non-blocking IO and Axiom.
> If it isn't then we should be fixing it so it does.
Yes, this is if you do not try to read the contents (i.e. for logging, 
or XPath expression evaluations etc)

I am not sure how you could save and restore a message context for a 
message received over http and send its response later.. unless you are 
using a separate channel for the response?

asankha
>
> Paul
>

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by Paul Fremantle <pz...@gmail.com>.
> Yes, but what's up if i receive 100 msg of 50 mb to route? (hope it
> never happens :P but i have to consider it)

Maybe Asankha will correct me, but Synapse should be forwarding
messages in constant memory because of the non-blocking IO and Axiom.
If it isn't then we should be fixing it so it does.

Paul

-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by Paul Fremantle <pz...@gmail.com>.
Lorenzo

Have you thought about using WSRM and Sandesha2? We have support for
this. This will ensure that messages are not duplicated when they are
resent. There is a persistent store for Sandesha2 on wso2.org.

I don't think RM will help with large MTOM files... thats an
interesting question. Of course Synapse will handle them more
efficiently if you don't store them as we can just stream them right
through.

Paul



On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
> Hi Paul, hi all
>
> i have to store messages before mediaton for two purposes
>
> 1) Resend pending messages if system crashes or endpoint is down for
> long time
> 2) Message archive
>
> First problem to solve is write and read message context. With AXIS1.2
> we can serialize it and save (as i did in previous mail) but i have
> something left to do to restore messagecontext.
>
> Second problem is file caching. If i have large attachments AXIS2 cache
> it on filesystem (as configured in axis.xml) then i want store in my
> DB.. One store in enough so would to skip axis2 caching without loading
> messages in memory.. i didn't study axis2 caching so i still don't know
> how it works exactly and how to customize it. This problem of multiple
> copy of message will return when i'll have to work with RM..
>
> Speaking of caching i have this doubt: i receive a msg with large
> attachment. I read in this article (http://www.wso2.org/library/1148)
> that cached attachment are loaded in memory only when user need it.
> what's up if i just need attachments ids? if i make a
> mc.getAttachmentMap().getAllContentIDs() i have the whole message in
> memory? Again, when the message go through the send mediator, cached
> attachments are direcly pumped out or are first loaded in memory?
>
> Thx for any suggestion,
> Lorenzo
>
>
>
>
>
>
> On mer, 2007-05-23 at 11:49 +0100, Paul Fremantle wrote:
> > Can you explain the scenario a little bit better? Seems like this
> > might be something really cool we could build into Synapse.
> >
> > Paul
> >
> > On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
> > > Hi all,
> > >
> > > i'm trying to store messages with synapse, but i have some problems:
> > >
> > > 1) Save message:
> > >         FileOutputStream fos = new FileOutputStream("MC.msg");
> > >         ObjectOutputStream obj_out = new ObjectOutputStream (fos);
> > >         obj_out.writeObject(mc);
> > >         obj_out.close();
> > >         fos.close();
> > > 2) Load message
> > >         FileInputStream file_mc = new
> > >         FileInputStream("MC.msg");
> > >         ObjectInputStream is_mc = new ObjectInputStream(file_mc);
> > >         newmc = (MessageContext) is_mc.readObject();
> > > 3) Activate it
> > >         mc.activate(confctx);
> > >
> > > Now when i try to mediate it i get:
> > >  Synapse received a new message for message mediation...
> > >  Received To: /SincronoAttachment/SincronoAttachment
> > >  SOAPAction: null
> > >  WSA-Action: null
> > >  Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org
> > >
> > > And i loose attachments (SOAP envelope is saved and correctly
> > > restored)..
> > > Moreover when it receive the response i get this error:
> > >  ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
> > > send message
> > >  ERROR Axis2Sender - Unexpected error during Sending message back
> > > org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
> > > send message
> > >
> > >
> > > What i have to do to complete the message save/restore?
> > >
> > > Thx!
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: synapse-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by Lorenzo <ce...@gmail.com>.
Hi Paul, hi all 

i have to store messages before mediaton for two purposes

1) Resend pending messages if system crashes or endpoint is down for
long time
2) Message archive 

First problem to solve is write and read message context. With AXIS1.2
we can serialize it and save (as i did in previous mail) but i have
something left to do to restore messagecontext.

Second problem is file caching. If i have large attachments AXIS2 cache
it on filesystem (as configured in axis.xml) then i want store in my
DB.. One store in enough so would to skip axis2 caching without loading
messages in memory.. i didn't study axis2 caching so i still don't know
how it works exactly and how to customize it. This problem of multiple
copy of message will return when i'll have to work with RM..

Speaking of caching i have this doubt: i receive a msg with large
attachment. I read in this article (http://www.wso2.org/library/1148)
that cached attachment are loaded in memory only when user need it.
what's up if i just need attachments ids? if i make a
mc.getAttachmentMap().getAllContentIDs() i have the whole message in
memory? Again, when the message go through the send mediator, cached
attachments are direcly pumped out or are first loaded in memory?

Thx for any suggestion,
Lorenzo






On mer, 2007-05-23 at 11:49 +0100, Paul Fremantle wrote:
> Can you explain the scenario a little bit better? Seems like this
> might be something really cool we could build into Synapse.
> 
> Paul
> 
> On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
> > Hi all,
> >
> > i'm trying to store messages with synapse, but i have some problems:
> >
> > 1) Save message:
> >         FileOutputStream fos = new FileOutputStream("MC.msg");
> >         ObjectOutputStream obj_out = new ObjectOutputStream (fos);
> >         obj_out.writeObject(mc);
> >         obj_out.close();
> >         fos.close();
> > 2) Load message
> >         FileInputStream file_mc = new
> >         FileInputStream("MC.msg");
> >         ObjectInputStream is_mc = new ObjectInputStream(file_mc);
> >         newmc = (MessageContext) is_mc.readObject();
> > 3) Activate it
> >         mc.activate(confctx);
> >
> > Now when i try to mediate it i get:
> >  Synapse received a new message for message mediation...
> >  Received To: /SincronoAttachment/SincronoAttachment
> >  SOAPAction: null
> >  WSA-Action: null
> >  Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org
> >
> > And i loose attachments (SOAP envelope is saved and correctly
> > restored)..
> > Moreover when it receive the response i get this error:
> >  ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
> > send message
> >  ERROR Axis2Sender - Unexpected error during Sending message back
> > org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
> > send message
> >
> >
> > What i have to do to complete the message save/restore?
> >
> > Thx!
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-user-help@ws.apache.org
> >
> >
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org


Re: Save and load message before mediation

Posted by Paul Fremantle <pz...@gmail.com>.
Can you explain the scenario a little bit better? Seems like this
might be something really cool we could build into Synapse.

Paul

On 5/23/07, Lorenzo <ce...@gmail.com> wrote:
> Hi all,
>
> i'm trying to store messages with synapse, but i have some problems:
>
> 1) Save message:
>         FileOutputStream fos = new FileOutputStream("MC.msg");
>         ObjectOutputStream obj_out = new ObjectOutputStream (fos);
>         obj_out.writeObject(mc);
>         obj_out.close();
>         fos.close();
> 2) Load message
>         FileInputStream file_mc = new
>         FileInputStream("MC.msg");
>         ObjectInputStream is_mc = new ObjectInputStream(file_mc);
>         newmc = (MessageContext) is_mc.readObject();
> 3) Activate it
>         mc.activate(confctx);
>
> Now when i try to mediate it i get:
>  Synapse received a new message for message mediation...
>  Received To: /SincronoAttachment/SincronoAttachment
>  SOAPAction: null
>  WSA-Action: null
>  Attachment : 0.urn:uuid:2BA278647671644B7D1179913123336@apache.org
>
> And i loose attachments (SOAP envelope is saved and correctly
> restored)..
> Moreover when it receive the response i get this error:
>  ERROR HttpCoreNIOSender - No valid destination EPR or OutputStream to
> send message
>  ERROR Axis2Sender - Unexpected error during Sending message back
> org.apache.axis2.AxisFault: No valid destination EPR or OutputStream to
> send message
>
>
> What i have to do to complete the message save/restore?
>
> Thx!
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-user-help@ws.apache.org