At the moment synapse doesn't support custom endpoints.

I guess what you can do is to write a custom send mediator that takes uses
your custom endpoint.

Thanks,
Supun..

On Fri, Mar 5, 2010 at 2:44 PM, Song Thuy Nguyen <[email protected]>wrote:

>  Hello everyone,
>
>
>
> I would like to implement a customized failover in synapse.
>
> For example :
>
>
>
> ###################the  synapse.xml to look like
> this####################################
>
>
>
> <definitions xmlns=*"http://ws.apache.org/ns/synapse"*>
>
>       <registry provider=*
> "org.apache.synapse.registry.url.SimpleURLRegistry"*>
>
>             <parameter name=*"root"*>file:./repository/conf/registry/</
> parameter>
>
>             <parameter name=*"cachableDuration"*>5000</parameter>
>
>       </registry>
>
>       <in>
>
>             <send>
>
>                   <class name="org.namespace.xyz.ExtendedFailover">
>
>                         <endpoint key="failoverendpoint.xml">
>
>                   </class>
>
>             </send>
>
>       </in>
>
>
>
>       <out>
>
>             <send/>
>
>       </out>
>
> </definitions>
>
>
>
> #####################the failoverenpoint.xml shoud be
> like:#########################
>
> <endpoint xmlns=*"http://ws.apache.org/ns/synapse"*>
>
>       <failover>
>
>             <endpoint name=*"add1ep"*>
>
>                   <address uri=*"http://127.0.0.1:1/add1"*>
>
>                         <suspendDurationOnFailure>0</
> suspendDurationOnFailure>
>
>                   </address>
>
>
>
>             </endpoint>
>
>             <endpoint name=*"add2ep"*>
>
>                   <address uri=*"http://127.0.0.1:2/add2"*>
>
>                         <suspendDurationOnFailure>0</
> suspendDurationOnFailure>
>
>                   </address>
>
>
>
>             </endpoint>
>
>             <endpoint name=*"add3ep"*>
>
>                   <address uri=*"http://127.0.0.1:3/add3"*>
>
>                         <suspendDurationOnFailure>0</
> suspendDurationOnFailure>
>
>                   </address>
>
>
>
>             </endpoint>
>
>       </failover>
>
> </endpoint>
>
>
>
> #####################################the
> ExtendedFailover.java##########################
>
> package org.namespace.xyz;
>
> * *
>
> *import* org.apache.synapse.endpoints.FailoverEndpoint;
>
> * *
>
> *public* *class* ExtendedFailoverMediator *extends* FailoverEndpoint{
>
>
>
>       //override and reuse some methods here
>
>
>
>
>
> }
>
>
> ###########################################################################################
>
>
>
> I want to implement an alternate failover behaviour: on every call to the
> service it will try the first endpoint (add1) ,if that one fails, it will
> try the second one(add2). This repeats with every later calls, even if the
> first endpoint failed in the previous call. There will be a code block that
> uses the existing setActive(boolean active, MessageContext
> synMessageContext)method to set the current active endpoint, this is
> controlled by another component outside of Synapse.
>
> And I also would like to have the possibility to sort the list of endpoints
> and write it back to the xml file in the registry. Looking at the methods
> provided by the FailoverEndpoint class, it seems I can reuse many of the
> existing methods. But where do I start?
>
> If the ExtendedFailover class mediator derives from FailoverEndpoint and I
> put the <class ….></class> expression around the endpoint defintion block
> (like in the example above) , will this block be automatically read by the
> ExtendedFailover-Mediator like the original FailoverEndpoint would do, so
> that I can access the list of endpoints with getEndpoints()? Or do I habe to
> provide the Factory and Serializer classes for Synpase to do so?
>
> Please give me jumpstart to do this.
>
>
>
> Thank you in advance!
>
>
>
> Greetings
>
>
>
> Thuy
>
>
>
>
>



-- 
Software Engineer, WSO2 Inc
http://wso2.org
supunk.blogspot.com

Reply via email to