You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Florin Bejinaru <fl...@gmail.com> on 2009/09/23 15:48:40 UTC

Sender based response filtering

At the moment I am using the following synapse.xml configuration file to
send a WS request to 2 different service implementations (that is a
requirement so it can't be changed):

    <in>
        <filter source="get-property('To')" regex=".*/Event.*">
            <clone continueParent="true">
                <target>
                    <endpoint>
                        <address uri="
http://192.168.239.1:8080/EventService/services/Event"/>
                    </endpoint>
                </target>
            </clone>
            <send>
                <endpoint>
                    <address uri="http://192.168.239.128:9000/services/Event
"/>
                </endpoint>
            </send>
            <drop/>
        </filter>
    </in>
    <out>
        <send/>
    </out>


The problem is that both of those return a response and I was wondering if I
could use synapse to filter out the response from a particular response
source, or do I need to rewrite one of those services to not return a
response (which I'm guessing is a bit tricky since Axis2 might be inclined
to use a InOutMessageReceiver based on the service's WSDL.)

Which would be a decent and simple solution to my problem ?

Thank you,
Florin

Re: Sender based response filtering

Posted by Florin Bejinaru <fl...@gmail.com>.
Yes but if it is inside the target element it doesn't replicate the request
and 8080 doesn't receive any request. And this way it seems to work ok.

I did try it exactly the way you said, and the service on the 8080 port
never received any request. I don't know exactly why that happens, but
that's what it does.

2009/9/24 ruwan.linton <ru...@gmail.com>

> Hi Florin,
>
> This configuration has an issue, the sequence which is setting the property
> inside the clone mediator has to be inside the target element, if you
> carefully have a look at the above config fragment I pasted on the earlier
> reply, the sequence is inside the target element, so please change the
> configuration to include that in the target element;
>
> Being said that it doesn't really affect the scenario that you are trying
> to
> implement, because you are not using the property value 8080 on the out
> path
> in this particular instance;
>
> So the modified config should read as;
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
>   <in>
>       <log level="full"/>
>        <filter source="get-property('To')" regex=".*/Event.*">
>           <clone continueParent="true">
>                 <target>
>                   <sequence>
>                     <property action="set" name="service-port"
> value="8080"/>
>                   </sequence>
>                   <endpoint>
>                       <address uri="
> http://192.168.239.1:8080/EventService/services/Event"/>
>                   </endpoint>
>               </target>
>           </clone>
>            <property action="set" name="service-port" value="9000"/>
>           <send>
>               <endpoint>
>                   <address uri="http://192.168.239.128:9000/services/Event
> "/>
>               </endpoint>
>           </send>
>           <drop/>
>       </filter>
>   </in>
>   <out>
>         <log level="full"/>
>
>       <filter source="get-property('service-port')" regex=".*9000.*">
>           <send/>
>       </filter>
>   </out>
> </definitions>
>
> Thanks,
> Ruwan
>
> On Thu, Sep 24, 2009 at 5:08 PM, Florin Bejinaru
> <fl...@gmail.com>wrote:
>
> > I noticed that no matter what the filtering was on the "out" mediator,
> > events still would not arrive at both service endpoints, so I started
> > suspecting that the service-port property in the clone mediator had
> > something to do with that.
> >
> > Long story short, now I am using the following configuration, and it
> seems
> > to work, requests are arriving at both endpoints and no more Response
> > already sent/Connection closed exceptions.
> >
> > In my experience though, just because something doesn't throw an
> exception
> > it doesn't mean it works, so can someone take a look at the following
> > config
> > and do a sanity check on it.
> >
> > <definitions xmlns="http://ws.apache.org/ns/synapse">
> >
> >    <in>
> >        <log level="full"/>
> >         <filter source="get-property('To')" regex=".*/Event.*">
> >            <clone continueParent="true">
> >                 <sequence>
> >                    <property action="set" name="service-port"
> > value="8080"/>
> >                </sequence>
> >                 <target>
> >                    <endpoint>
> >                        <address uri="
> > http://192.168.239.1:8080/EventService/services/Event"/>
> >                    </endpoint>
> >                </target>
> >            </clone>
> >             <property action="set" name="service-port" value="9000"/>
> >            <send>
> >                <endpoint>
> >                    <address uri="
> > http://192.168.239.128:9000/services/Event
> > "/>
> >                </endpoint>
> >            </send>
> >            <drop/>
> >        </filter>
> >    </in>
> >    <out>
> >         <log level="full"/>
> >
> >        <filter source="get-property('service-port')" regex=".*9000.*">
> >            <send/>
> >        </filter>
> >    </out>
> > </definitions>
> >
> > Thank you,
> > Florin
> >
> > 2009/9/24 Florin Bejinaru <fl...@gmail.com>
> >
> > > Actually the filter on the out mediator filters the requests as well as
> > the
> > > responses, I just need to filter the responses, I have tried with
> > something
> > > like this:
> > >
> > >     <out>
> > >         <log level="full"/>
> > >         <filter source="get-property('Direction')" regex=".*request.*">
> > >             <send/>
> > >         </filter>
> > >         <filter source="get-property('service-port')" regex=".*9000.*">
> > >             <send/>
> > >         </filter>
> > >     </out>
> > >
> > > But it still doesn't send the request for the 8080 service port
> through.
> > > How do I get it to send all the requests through but only the 9000
> > response
> > > ?
> > >
> > > Thank you,
> > > Florin
> > >
> > > 2009/9/24 Ruwan Linton <ru...@gmail.com>
> > >
> > > Hi Florin,
> > >>
> > >> So, if I understand the requirement correctly you need to filter out
> the
> > >> response from a specified service, right? If the requirement is to
> > filter
> > >> out any response, that is only look for the first response without
> > waiting
> > >> for the second, you could have done that with the aggregate mediator,
> > with
> > >> the maximum message count to complete the aggregation set to 1.
> > >>
> > >> If that is the former, then you need to have a content based router at
> > the
> > >> out path of the flow and drop the messages from the server that you
> want
> > >> to
> > >> filter out. See the following config assuming that you want to drop
> the
> > >> response from the service running at port 8080; If it is the other way
> > >> around you just need to change the regex in the out path filter to
> > >> ".*8080.*"
> > >>
> > >>
> > >> <in>
> > >>       <filter source="get-property('To')" regex=".*/Event.*">
> > >>           <clone continueParent="true">
> > >>               <target>
> > >>                    <sequence>
> > >>                      <property action="set" name="service-port"
> > >> value="8080"/>
> > >>                   </sequence>
> > >>                    <endpoint>
> > >>                       <address uri="
> > >> http://192.168.239.1:8080/EventService/services/Event"/>
> > >>                   </endpoint>
> > >>               </target>
> > >>           </clone>
> > >>            <property action="set" name="service-port" value="9000"/>
> > >>            <send>
> > >>               <endpoint>
> > >>                   <address uri="
> > >> http://192.168.239.128:9000/services/Event
> > >> "/>
> > >>               </endpoint>
> > >>           </send>
> > >>           <drop/>
> > >>       </filter>
> > >>   </in>
> > >>   <out>
> > >>        <filter source="get-property('service-port')" regex=".*9000.*">
> > >>         <send/>
> > >>       </filter>
> > >>   </out>
> > >>
> > >> Hope this helps...
> > >>
> > >> Thanks,
> > >> Ruwan
> > >>
> > >> On Wed, Sep 23, 2009 at 7:18 PM, Florin Bejinaru
> > >> <fl...@gmail.com>wrote:
> > >>
> > >> > At the moment I am using the following synapse.xml configuration
> file
> > to
> > >> > send a WS request to 2 different service implementations (that is a
> > >> > requirement so it can't be changed):
> > >> >
> > >> >    <in>
> > >> >        <filter source="get-property('To')" regex=".*/Event.*">
> > >> >            <clone continueParent="true">
> > >> >                <target>
> > >> >                    <endpoint>
> > >> >                        <address uri="
> > >> > http://192.168.239.1:8080/EventService/services/Event"/>
> > >> >                    </endpoint>
> > >> >                </target>
> > >> >            </clone>
> > >> >            <send>
> > >> >                <endpoint>
> > >> >                    <address uri="
> > >> > http://192.168.239.128:9000/services/Event
> > >> > "/>
> > >> >                </endpoint>
> > >> >            </send>
> > >> >            <drop/>
> > >> >        </filter>
> > >> >    </in>
> > >> >    <out>
> > >> >        <send/>
> > >> >    </out>
> > >> >
> > >> >
> > >> > The problem is that both of those return a response and I was
> > wondering
> > >> if
> > >> > I
> > >> > could use synapse to filter out the response from a particular
> > response
> > >> > source, or do I need to rewrite one of those services to not return
> a
> > >> > response (which I'm guessing is a bit tricky since Axis2 might be
> > >> inclined
> > >> > to use a InOutMessageReceiver based on the service's WSDL.)
> > >> >
> > >> > Which would be a decent and simple solution to my problem ?
> > >> >
> > >> > Thank you,
> > >> > Florin
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Ruwan Linton
> > >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> > >> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
> > >> email: ruwan@wso2.com; cell: +94 77 341 3097
> > >> blog: http://ruwansblog.blogspot.com
> > >>
> > >
> > >
> >
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>

Re: Sender based response filtering

Posted by "ruwan.linton" <ru...@gmail.com>.
Hi Florin,

This configuration has an issue, the sequence which is setting the property
inside the clone mediator has to be inside the target element, if you
carefully have a look at the above config fragment I pasted on the earlier
reply, the sequence is inside the target element, so please change the
configuration to include that in the target element;

Being said that it doesn't really affect the scenario that you are trying to
implement, because you are not using the property value 8080 on the out path
in this particular instance;

So the modified config should read as;

<definitions xmlns="http://ws.apache.org/ns/synapse">

   <in>
       <log level="full"/>
        <filter source="get-property('To')" regex=".*/Event.*">
           <clone continueParent="true">
                <target>
                   <sequence>
                     <property action="set" name="service-port"
value="8080"/>
                   </sequence>
                   <endpoint>
                       <address uri="
http://192.168.239.1:8080/EventService/services/Event"/>
                   </endpoint>
               </target>
           </clone>
            <property action="set" name="service-port" value="9000"/>
           <send>
               <endpoint>
                   <address uri="http://192.168.239.128:9000/services/Event
"/>
               </endpoint>
           </send>
           <drop/>
       </filter>
   </in>
   <out>
        <log level="full"/>

       <filter source="get-property('service-port')" regex=".*9000.*">
           <send/>
       </filter>
   </out>
</definitions>

Thanks,
Ruwan

On Thu, Sep 24, 2009 at 5:08 PM, Florin Bejinaru
<fl...@gmail.com>wrote:

> I noticed that no matter what the filtering was on the "out" mediator,
> events still would not arrive at both service endpoints, so I started
> suspecting that the service-port property in the clone mediator had
> something to do with that.
>
> Long story short, now I am using the following configuration, and it seems
> to work, requests are arriving at both endpoints and no more Response
> already sent/Connection closed exceptions.
>
> In my experience though, just because something doesn't throw an exception
> it doesn't mean it works, so can someone take a look at the following
> config
> and do a sanity check on it.
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>
>    <in>
>        <log level="full"/>
>         <filter source="get-property('To')" regex=".*/Event.*">
>            <clone continueParent="true">
>                 <sequence>
>                    <property action="set" name="service-port"
> value="8080"/>
>                </sequence>
>                 <target>
>                    <endpoint>
>                        <address uri="
> http://192.168.239.1:8080/EventService/services/Event"/>
>                    </endpoint>
>                </target>
>            </clone>
>             <property action="set" name="service-port" value="9000"/>
>            <send>
>                <endpoint>
>                    <address uri="
> http://192.168.239.128:9000/services/Event
> "/>
>                </endpoint>
>            </send>
>            <drop/>
>        </filter>
>    </in>
>    <out>
>         <log level="full"/>
>
>        <filter source="get-property('service-port')" regex=".*9000.*">
>            <send/>
>        </filter>
>    </out>
> </definitions>
>
> Thank you,
> Florin
>
> 2009/9/24 Florin Bejinaru <fl...@gmail.com>
>
> > Actually the filter on the out mediator filters the requests as well as
> the
> > responses, I just need to filter the responses, I have tried with
> something
> > like this:
> >
> >     <out>
> >         <log level="full"/>
> >         <filter source="get-property('Direction')" regex=".*request.*">
> >             <send/>
> >         </filter>
> >         <filter source="get-property('service-port')" regex=".*9000.*">
> >             <send/>
> >         </filter>
> >     </out>
> >
> > But it still doesn't send the request for the 8080 service port through.
> > How do I get it to send all the requests through but only the 9000
> response
> > ?
> >
> > Thank you,
> > Florin
> >
> > 2009/9/24 Ruwan Linton <ru...@gmail.com>
> >
> > Hi Florin,
> >>
> >> So, if I understand the requirement correctly you need to filter out the
> >> response from a specified service, right? If the requirement is to
> filter
> >> out any response, that is only look for the first response without
> waiting
> >> for the second, you could have done that with the aggregate mediator,
> with
> >> the maximum message count to complete the aggregation set to 1.
> >>
> >> If that is the former, then you need to have a content based router at
> the
> >> out path of the flow and drop the messages from the server that you want
> >> to
> >> filter out. See the following config assuming that you want to drop the
> >> response from the service running at port 8080; If it is the other way
> >> around you just need to change the regex in the out path filter to
> >> ".*8080.*"
> >>
> >>
> >> <in>
> >>       <filter source="get-property('To')" regex=".*/Event.*">
> >>           <clone continueParent="true">
> >>               <target>
> >>                    <sequence>
> >>                      <property action="set" name="service-port"
> >> value="8080"/>
> >>                   </sequence>
> >>                    <endpoint>
> >>                       <address uri="
> >> http://192.168.239.1:8080/EventService/services/Event"/>
> >>                   </endpoint>
> >>               </target>
> >>           </clone>
> >>            <property action="set" name="service-port" value="9000"/>
> >>            <send>
> >>               <endpoint>
> >>                   <address uri="
> >> http://192.168.239.128:9000/services/Event
> >> "/>
> >>               </endpoint>
> >>           </send>
> >>           <drop/>
> >>       </filter>
> >>   </in>
> >>   <out>
> >>        <filter source="get-property('service-port')" regex=".*9000.*">
> >>         <send/>
> >>       </filter>
> >>   </out>
> >>
> >> Hope this helps...
> >>
> >> Thanks,
> >> Ruwan
> >>
> >> On Wed, Sep 23, 2009 at 7:18 PM, Florin Bejinaru
> >> <fl...@gmail.com>wrote:
> >>
> >> > At the moment I am using the following synapse.xml configuration file
> to
> >> > send a WS request to 2 different service implementations (that is a
> >> > requirement so it can't be changed):
> >> >
> >> >    <in>
> >> >        <filter source="get-property('To')" regex=".*/Event.*">
> >> >            <clone continueParent="true">
> >> >                <target>
> >> >                    <endpoint>
> >> >                        <address uri="
> >> > http://192.168.239.1:8080/EventService/services/Event"/>
> >> >                    </endpoint>
> >> >                </target>
> >> >            </clone>
> >> >            <send>
> >> >                <endpoint>
> >> >                    <address uri="
> >> > http://192.168.239.128:9000/services/Event
> >> > "/>
> >> >                </endpoint>
> >> >            </send>
> >> >            <drop/>
> >> >        </filter>
> >> >    </in>
> >> >    <out>
> >> >        <send/>
> >> >    </out>
> >> >
> >> >
> >> > The problem is that both of those return a response and I was
> wondering
> >> if
> >> > I
> >> > could use synapse to filter out the response from a particular
> response
> >> > source, or do I need to rewrite one of those services to not return a
> >> > response (which I'm guessing is a bit tricky since Axis2 might be
> >> inclined
> >> > to use a InOutMessageReceiver based on the service's WSDL.)
> >> >
> >> > Which would be a decent and simple solution to my problem ?
> >> >
> >> > Thank you,
> >> > Florin
> >> >
> >>
> >>
> >>
> >> --
> >> Ruwan Linton
> >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> >> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
> >> email: ruwan@wso2.com; cell: +94 77 341 3097
> >> blog: http://ruwansblog.blogspot.com
> >>
> >
> >
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Re: Sender based response filtering

Posted by Florin Bejinaru <fl...@gmail.com>.
I noticed that no matter what the filtering was on the "out" mediator,
events still would not arrive at both service endpoints, so I started
suspecting that the service-port property in the clone mediator had
something to do with that.

Long story short, now I am using the following configuration, and it seems
to work, requests are arriving at both endpoints and no more Response
already sent/Connection closed exceptions.

In my experience though, just because something doesn't throw an exception
it doesn't mean it works, so can someone take a look at the following config
and do a sanity check on it.

<definitions xmlns="http://ws.apache.org/ns/synapse">

    <in>
        <log level="full"/>
        <filter source="get-property('To')" regex=".*/Event.*">
            <clone continueParent="true">
                <sequence>
                    <property action="set" name="service-port"
value="8080"/>
                </sequence>
                <target>
                    <endpoint>
                        <address uri="
http://192.168.239.1:8080/EventService/services/Event"/>
                    </endpoint>
                </target>
            </clone>
            <property action="set" name="service-port" value="9000"/>
            <send>
                <endpoint>
                    <address uri="http://192.168.239.128:9000/services/Event
"/>
                </endpoint>
            </send>
            <drop/>
        </filter>
    </in>
    <out>
        <log level="full"/>

        <filter source="get-property('service-port')" regex=".*9000.*">
            <send/>
        </filter>
    </out>
</definitions>

Thank you,
Florin

2009/9/24 Florin Bejinaru <fl...@gmail.com>

> Actually the filter on the out mediator filters the requests as well as the
> responses, I just need to filter the responses, I have tried with something
> like this:
>
>     <out>
>         <log level="full"/>
>         <filter source="get-property('Direction')" regex=".*request.*">
>             <send/>
>         </filter>
>         <filter source="get-property('service-port')" regex=".*9000.*">
>             <send/>
>         </filter>
>     </out>
>
> But it still doesn't send the request for the 8080 service port through.
> How do I get it to send all the requests through but only the 9000 response
> ?
>
> Thank you,
> Florin
>
> 2009/9/24 Ruwan Linton <ru...@gmail.com>
>
> Hi Florin,
>>
>> So, if I understand the requirement correctly you need to filter out the
>> response from a specified service, right? If the requirement is to filter
>> out any response, that is only look for the first response without waiting
>> for the second, you could have done that with the aggregate mediator, with
>> the maximum message count to complete the aggregation set to 1.
>>
>> If that is the former, then you need to have a content based router at the
>> out path of the flow and drop the messages from the server that you want
>> to
>> filter out. See the following config assuming that you want to drop the
>> response from the service running at port 8080; If it is the other way
>> around you just need to change the regex in the out path filter to
>> ".*8080.*"
>>
>>
>> <in>
>>       <filter source="get-property('To')" regex=".*/Event.*">
>>           <clone continueParent="true">
>>               <target>
>>                    <sequence>
>>                      <property action="set" name="service-port"
>> value="8080"/>
>>                   </sequence>
>>                    <endpoint>
>>                       <address uri="
>> http://192.168.239.1:8080/EventService/services/Event"/>
>>                   </endpoint>
>>               </target>
>>           </clone>
>>            <property action="set" name="service-port" value="9000"/>
>>            <send>
>>               <endpoint>
>>                   <address uri="
>> http://192.168.239.128:9000/services/Event
>> "/>
>>               </endpoint>
>>           </send>
>>           <drop/>
>>       </filter>
>>   </in>
>>   <out>
>>        <filter source="get-property('service-port')" regex=".*9000.*">
>>         <send/>
>>       </filter>
>>   </out>
>>
>> Hope this helps...
>>
>> Thanks,
>> Ruwan
>>
>> On Wed, Sep 23, 2009 at 7:18 PM, Florin Bejinaru
>> <fl...@gmail.com>wrote:
>>
>> > At the moment I am using the following synapse.xml configuration file to
>> > send a WS request to 2 different service implementations (that is a
>> > requirement so it can't be changed):
>> >
>> >    <in>
>> >        <filter source="get-property('To')" regex=".*/Event.*">
>> >            <clone continueParent="true">
>> >                <target>
>> >                    <endpoint>
>> >                        <address uri="
>> > http://192.168.239.1:8080/EventService/services/Event"/>
>> >                    </endpoint>
>> >                </target>
>> >            </clone>
>> >            <send>
>> >                <endpoint>
>> >                    <address uri="
>> > http://192.168.239.128:9000/services/Event
>> > "/>
>> >                </endpoint>
>> >            </send>
>> >            <drop/>
>> >        </filter>
>> >    </in>
>> >    <out>
>> >        <send/>
>> >    </out>
>> >
>> >
>> > The problem is that both of those return a response and I was wondering
>> if
>> > I
>> > could use synapse to filter out the response from a particular response
>> > source, or do I need to rewrite one of those services to not return a
>> > response (which I'm guessing is a bit tricky since Axis2 might be
>> inclined
>> > to use a InOutMessageReceiver based on the service's WSDL.)
>> >
>> > Which would be a decent and simple solution to my problem ?
>> >
>> > Thank you,
>> > Florin
>> >
>>
>>
>>
>> --
>> Ruwan Linton
>> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://ruwansblog.blogspot.com
>>
>
>

Re: Sender based response filtering

Posted by Florin Bejinaru <fl...@gmail.com>.
Actually the filter on the out mediator filters the requests as well as the
responses, I just need to filter the responses, I have tried with something
like this:

    <out>
        <log level="full"/>
        <filter source="get-property('Direction')" regex=".*request.*">
            <send/>
        </filter>
        <filter source="get-property('service-port')" regex=".*9000.*">
            <send/>
        </filter>
    </out>

But it still doesn't send the request for the 8080 service port through.
How do I get it to send all the requests through but only the 9000 response
?

Thank you,
Florin

2009/9/24 Ruwan Linton <ru...@gmail.com>

> Hi Florin,
>
> So, if I understand the requirement correctly you need to filter out the
> response from a specified service, right? If the requirement is to filter
> out any response, that is only look for the first response without waiting
> for the second, you could have done that with the aggregate mediator, with
> the maximum message count to complete the aggregation set to 1.
>
> If that is the former, then you need to have a content based router at the
> out path of the flow and drop the messages from the server that you want to
> filter out. See the following config assuming that you want to drop the
> response from the service running at port 8080; If it is the other way
> around you just need to change the regex in the out path filter to
> ".*8080.*"
>
>
> <in>
>       <filter source="get-property('To')" regex=".*/Event.*">
>           <clone continueParent="true">
>               <target>
>                    <sequence>
>                      <property action="set" name="service-port"
> value="8080"/>
>                   </sequence>
>                    <endpoint>
>                       <address uri="
> http://192.168.239.1:8080/EventService/services/Event"/>
>                   </endpoint>
>               </target>
>           </clone>
>            <property action="set" name="service-port" value="9000"/>
>            <send>
>               <endpoint>
>                   <address uri="http://192.168.239.128:9000/services/Event
> "/>
>               </endpoint>
>           </send>
>           <drop/>
>       </filter>
>   </in>
>   <out>
>        <filter source="get-property('service-port')" regex=".*9000.*">
>         <send/>
>       </filter>
>   </out>
>
> Hope this helps...
>
> Thanks,
> Ruwan
>
> On Wed, Sep 23, 2009 at 7:18 PM, Florin Bejinaru
> <fl...@gmail.com>wrote:
>
> > At the moment I am using the following synapse.xml configuration file to
> > send a WS request to 2 different service implementations (that is a
> > requirement so it can't be changed):
> >
> >    <in>
> >        <filter source="get-property('To')" regex=".*/Event.*">
> >            <clone continueParent="true">
> >                <target>
> >                    <endpoint>
> >                        <address uri="
> > http://192.168.239.1:8080/EventService/services/Event"/>
> >                    </endpoint>
> >                </target>
> >            </clone>
> >            <send>
> >                <endpoint>
> >                    <address uri="
> > http://192.168.239.128:9000/services/Event
> > "/>
> >                </endpoint>
> >            </send>
> >            <drop/>
> >        </filter>
> >    </in>
> >    <out>
> >        <send/>
> >    </out>
> >
> >
> > The problem is that both of those return a response and I was wondering
> if
> > I
> > could use synapse to filter out the response from a particular response
> > source, or do I need to rewrite one of those services to not return a
> > response (which I'm guessing is a bit tricky since Axis2 might be
> inclined
> > to use a InOutMessageReceiver based on the service's WSDL.)
> >
> > Which would be a decent and simple solution to my problem ?
> >
> > Thank you,
> > Florin
> >
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>

Re: Sender based response filtering

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Florin,

So, if I understand the requirement correctly you need to filter out the
response from a specified service, right? If the requirement is to filter
out any response, that is only look for the first response without waiting
for the second, you could have done that with the aggregate mediator, with
the maximum message count to complete the aggregation set to 1.

If that is the former, then you need to have a content based router at the
out path of the flow and drop the messages from the server that you want to
filter out. See the following config assuming that you want to drop the
response from the service running at port 8080; If it is the other way
around you just need to change the regex in the out path filter to
".*8080.*"


<in>
       <filter source="get-property('To')" regex=".*/Event.*">
           <clone continueParent="true">
               <target>
                   <sequence>
                      <property action="set" name="service-port"
value="8080"/>
                   </sequence>
                   <endpoint>
                       <address uri="
http://192.168.239.1:8080/EventService/services/Event"/>
                   </endpoint>
               </target>
           </clone>
           <property action="set" name="service-port" value="9000"/>
           <send>
               <endpoint>
                   <address uri="http://192.168.239.128:9000/services/Event
"/>
               </endpoint>
           </send>
           <drop/>
       </filter>
   </in>
   <out>
       <filter source="get-property('service-port')" regex=".*9000.*">
         <send/>
       </filter>
   </out>

Hope this helps...

Thanks,
Ruwan

On Wed, Sep 23, 2009 at 7:18 PM, Florin Bejinaru
<fl...@gmail.com>wrote:

> At the moment I am using the following synapse.xml configuration file to
> send a WS request to 2 different service implementations (that is a
> requirement so it can't be changed):
>
>    <in>
>        <filter source="get-property('To')" regex=".*/Event.*">
>            <clone continueParent="true">
>                <target>
>                    <endpoint>
>                        <address uri="
> http://192.168.239.1:8080/EventService/services/Event"/>
>                    </endpoint>
>                </target>
>            </clone>
>            <send>
>                <endpoint>
>                    <address uri="
> http://192.168.239.128:9000/services/Event
> "/>
>                </endpoint>
>            </send>
>            <drop/>
>        </filter>
>    </in>
>    <out>
>        <send/>
>    </out>
>
>
> The problem is that both of those return a response and I was wondering if
> I
> could use synapse to filter out the response from a particular response
> source, or do I need to rewrite one of those services to not return a
> response (which I'm guessing is a bit tricky since Axis2 might be inclined
> to use a InOutMessageReceiver based on the service's WSDL.)
>
> Which would be a decent and simple solution to my problem ?
>
> Thank you,
> Florin
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com