Hi Ruwan, Once again i need your help.
I have to get the original message that was cloned in different sequences in order to log it!! How can i get the original message inside the sequence?? Riyadh On Tue, Mar 18, 2008 at 7:50 PM, Ruwan Linton <[EMAIL PROTECTED]> wrote: > Riyadh wrote: > > Thank you again:) > > > > Regarding the map: > > > > >Where are you planing to keep this map, you can not keep it in the > > >message context, rather you will have to use the SynapseConfiguration > > >because the cloned messages are independent. > > could you please provide me a link about the the usage of Map in > > Synapse configuration? > Riyadh, > > I think I am wrong here, it is better to follow the singleton class > approach, but be careful when clearing the Map from concurrency issues. > > Thanks, > Ruwan > > > > i thought to use a class containing a static map and table. The > > mediators beforeSend and beforeDrop creates a singleton instance of > > that class to get the same map and table. After each clone the map and > > table are cleared so that those can be used for the next mediation. > > > > Riyadh > > On Tue, Mar 18, 2008 at 5:38 PM, Ruwan Linton <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > Well Riyadh, > > > > I think this solution is same as the one I just proposed but you are > > using a Map in memory rather than the database... Isn't it? So far I > > don't see any problem in the proposed solution. Please see my > comments > > inline; > > Riyadh wrote: > > > Hi, > > > > > > Thank you so much for your fruitful explanation. > > > > > > We have a simple idea to implement the requirements. i will > > explain it > > > now. I have crafted the idea relying on the following info that > you > > > gave about the clone mediators in a previous mail: > > > > > > >messageSequence ==> which will be something like 1/4, 3/4, etc... > > > > ($message_number/$number_of_cloned_messages) > > > > aggregateCorelation ==> the message id of the parent > > message from > > > > which > > > > these messages are cloned > > > > > > The idea: > > > > > > i will use a Map (indexed by the messageSequence ) and a simple > > table > > > which will contain the service related information taken from the > > > message. Both of them should be available to all the sequences. > > Where are you planing to keep this map, you can not keep it in the > > message context, rather you will have to use the > SynapseConfiguration > > because the cloned messages are independent. > > > > > > I will have two mediators: beforeSend and beforeDrop. > > > > > > beforeSend mediator is placed just before any send mediator and > > > similarly for the beforeDrop mediator just before any drop > mediator. > > > These are same for every sequence in the clone. > > > > > > Inside the beforeSend mediator: > > > > > > 1. store the cloned message into the Map with respect to the > > > messageSequence. (synchronize) > > > 2. Add service related inforrmation into the table > > > (as sent) .(synchronize) > > > 3. check whether the Map is filled in by every other sequence (as > we > > > know number_of_cloned_messages should be). > > > if yes then > > > add the service related information from the table into > the > > > Message and then log it > > > otherwise continue with the next send mediator > > > > > > Inside the beforeDrop mediator: > > > > > > 1. like before > > > 2. Add service related inforrmation into the table (as not sent). > > > (synchronize) > > > 3. check whether the Map is filled in by every other sequence (as > we > > > know number_of_cloned_messages). > > > if no then wait.. > > > otherwise add the service related information from the table > > into > > > the Message and then log it > > > 4. continue with the next drop mediator > > Seems fine. > > > > > > > > > As i said i this idea is based on the info you gave in a > > previous mail > > > and then i tried to check the source of clone mediator in this > > link.. > > > > > > > > > http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eip/splitter/CloneMediator.java?view=log > > > > > > and i did not find any get method to get the values > > > of "message_number " , "number_of_cloned_messages", > > > "aggregateCorelation". Now i am wondering what to do now? > > These are stored as properties inside the message context > > > > to get the parent messageID > > MessageContext.getProperty("aggregateCorelation"); > > > > to get the message number > > ((String) > > MessageContext.getProperty("messageSequence")).split("/")[0]; > > > > to get the number of messages > > ((String) > > MessageContext.getProperty("messageSequence")).split("/")[1]; > > > > Hope this will help you to proceed... > > > > > > Could you please comment and suggestions about the mentioned idea? > > > > > > > > > We keep your solution with dbreport as an advance mechanism for > > latter > > > exploration. > > > > > Cool :-) > > > > Thanks, > > Ruwan > > > > > > Thank you. > > > > > > Riyadh > > > > > > > > > > > > > > > On Tue, Mar 18, 2008 at 3:16 PM, Ruwan Linton <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]> > > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote: > > > > > > OK Riyadh, > > > > > > Now your requirement is clear to me. Please see my comments > > inline; > > > > > > Riyadh wrote: > > > > Hi Ruwan, > > > > > > > > We are not concerned about the successful delivery but only > > > > successfull sending from a sequence!! neverthless the > > solution > > > that > > > > you gave in the last mail was really helpful for me to > > > understand how > > > > i can capture the delivery. > > > > > > > > I am restating my requiremetns again here with the > aggregation > > > > previous mails:) > > > > > > > > > > > > > > > > Requirements: > > > > > > > > "We have a clone mediator which clones the same message to > a > > > number > > > > of sequence mediators where each sequence mediator > > contains a set of > > > > mediators. Each sequence is basically associated to a > service > > > and the > > > > sequence itself decides whether the service should receive > the > > > message > > > > or not. Consequently each sequence has a send mediator at > > the end in > > > > the sequence to send the message to the service. > > > > > > > > Any sequence mediator in the clone may drop the message > > before it > > > > reaches the send mediator. So requirement does not > > prohibit sending > > > > message out from any sequence if any other sequnce fails. > > > > > > > > At the end of clone we want to determine that to which > > services the > > > > message was sent and not sent and log this infromation. We > > will use > > > > our custom log mediator to log it. We want to log > > (containing the > > > > information of service endpoints to which the message was > sent > > > and not > > > > sent ) only once after the clone considering that each > > sequence > > > in the > > > > clone mediates the same message copy. > > > Well I think you can use a DBReport mediator before each and > > every > > > drop > > > to report dropped messages to the database and a DBReport > > mediator > > > after > > > the send mediator to report the messages that has been sent > > out, and > > > then write your own custom mediator to log the information > > fetched > > > from > > > the database. In-order to do this you will require the > > access to a > > > database. > > > > > > I think the above point is clear to you. Have a look at the > > DBReport > > > mediator sample > > > > > ( > http://wso2.org/project/esb/java/1.6/docs/ESB_Samples.html#Sample361) > > > > > > Now the problem is how you can figure out the end of the > > mediation of > > > all the cloned messages, so that we can put the custom > mediator > > > that you > > > are going to write to fetch the information from the > > database and log > > > them as per your requirement. > > > > > > It is not that easy to find the finishing point because all > > these are > > > independent messages inside synapse, So if it is OK to have > > some delay > > > in logging these messages, you could right a Task > > > (http://wso2.org/library/2900) to log the messages rather > > than a > > > mediator, so that the task can be scheduled to wakeup in a > > given > > > interval and check for the reported messages in the database > and > > > figure > > > out the messages which are with a common aggregateCorelation > > and log > > > them and mark them as logged in the database (or delete them > > from > > > db) so > > > that you wont log the same information over and over. Have a > > look > > > at the > > > sample task here > > > > > (http://wso2.org/project/esb/java/1.6/docs/ESB_Samples.html#Task) > > > > > > Will this be helpful? It is really hard to figure out the > > end of every > > > cloned messages since they are independent and processed in > > parallel. > > > > > > Thanks, > > > Ruwan > > > > > > > > Now if any sequence in the clone fails, the message is not > > sent > > > to the > > > > corresponding service. How do i capture the information > > (containing > > > > the information of service endpoints to which the message > > was sent > > > > and not sent ) at the end of clone?" > > > > > > > > I hope i could explain better now:). > > > > > > > > > > > > we tryed to use a custom mediator right after the clone > (with > > > > continueparent = true) thinking that we would get info > > after the > > > clone > > > > and log it once. But we failed to do that!!!! It seems > > control never > > > > passes after the clone!!! > > > > > > > > Thank you again. > > > > > > > > Riyadh > > > > > > > > On Tue, Mar 18, 2008 at 7:50 AM, Ruwan Linton > > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>> wrote: > > > > > > > > Hi Riyadh, > > > > > > > > Riyadh wrote: > > > > > Hi Ruwan, > > > > > > > > > > >>Isn't there a requirement saying that if one > > sequence drops > > > > the message > > > > > >>non of the sequences are going to send the message > > out. I > > > > understood > > > > > >>your requirement like that..... Please correct me if > I > > > am wrong. > > > > > > > > > > No..my requirement does not prohibit sending message > out > > > from any > > > > > sequence if any other sequnce fails. i have to capture > > > only the > > > > > services to which the message was successfully sent > > from the > > > > > corresponding sequnce. > > > > AAAAAhhhhhhhh... Sorry, I was making it complex. Well, > > there > > > is no way > > > > inside synapse that we can detect the successful > > delivery at > > > least for > > > > the moment. But you could simulate this using the > response > > > message > > > > from > > > > the server, assuming this is a two way communication. > > > > > > > > You need to set the address to which you send the > > message as > > > a message > > > > property using the property mediator before sending > > the message > > > > out and > > > > these properties will be available in the response > > from the > > > server. So > > > > when the response arrives to ESB, you could use the > above > > > property > > > > that > > > > we set to the message to retrieve the service endpoint, > > > since you got > > > > the response you can guarantee that the message has been > > > delivered to > > > > the appropriate service. > > > > > > > > Will this be OK with you? > > > > > > > > Thanks, > > > > Ruwan > > > > > > > > > > > > _______________________________________________ > > > > Esb-java-dev mailing list > > > > [email protected] <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>> > > > <mailto:[email protected] <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>>> > > > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > > > Esb-java-dev mailing list > > > > [email protected] <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>> > > > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > > > > > > > > > _______________________________________________ > > > Esb-java-dev mailing list > > > [email protected] <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>> > > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Esb-java-dev mailing list > > > [email protected] <mailto:[email protected]> > > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > > > > > _______________________________________________ > > Esb-java-dev mailing list > > [email protected] <mailto:[email protected]> > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Esb-java-dev mailing list > > [email protected] > > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev > > > > > _______________________________________________ > Esb-java-dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev >
_______________________________________________ Esb-java-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
