2

Can a message be sent to multiple endpoints from within the send mediator in a proxy service?

This link from the WSO2 ESB Send Mediator documentation says under the Syntax chapter that If the message is to be sent to one or more endpoints, then the following is used:

<send>
    (endpointref | endpoint)+
</send>

where the endpointref token refers to the following:

<endpoint key="name"/>

I've tried to include two endpoints under send, but the second one gets removed automatically when saving the proxy service (inside the Developer Studio or straight in the ESB Stratos interface). I did go to the Synapse page for the Send Mediator to see if they say anything special and their format says:

(endpointref | endpoint)?

Now assuming these characters represent regular expression, ? stands for 0 or 1 times, + is 1 or more times. Did WSO2 implement this extra "one or more endpoints" feature on top of Synapse Send Mediator or is it just a mistake on the documentation pages. If they did, what's the exact syntax to make it work?

Thank you!

Community
  • 1
  • 1
Voicu
  • 16,921
  • 10
  • 60
  • 69

3 Answers3

2

Actually you can use Recipienlist endpoint to send a single message to multiple endpoints. After defining recipient list store taht as localentry and provide that as endpoint key.

Ratha
  • 9,434
  • 17
  • 85
  • 163
  • Thank you Ratha. That would work in the WSO2 ESB 4.5+, but unfortunately, we're using ESB 4.0.3 inside a Stratos deployment and an upgrade is not an option right now. Any idea why the documentation mentions the "one or more endpoints" even in the ESB 4.0.3 documentation? (link was posted in question) – Voicu Mar 14 '13 at 17:16
  • That one or more indicates, say if there is a loadbalance/failover endpoint, the configuration will have more than one endpoint. But as you tried, you can not define multiple leaf endpoints(ie: address endpoint) in a single send mediotr. The only way is, recipient list endpoint, but that is available in later versions only..What is your actual usecase to send same message to multiple endpoints? – Ratha Mar 14 '13 at 18:21
  • We were trying to send a JMS message (from within a JMS transport proxy service) to a VFS endpoint as well as archive it to another VFS endpoint (keeping the same file name defined as transport.vfs.ReplyFileName). We ended up using the clone mediator with two target sequences that are sending to one VFS endpoint each. – Voicu Mar 26 '13 at 22:09
2

You can do something like this:

<send>
    <endpoint key="jmsMBendpoint1"/>
    </send>
                                     <send>
                                        <endpoint key="jmsMBendpoint2"/>
                                     </send>

.I have used this approach and is working for me.

Roy
  • 1,231
  • 1
  • 24
  • 61
0

You can use the clone mediator to send to multiple endpoints with specifying respective endpoints as in the below configuration.

<sequence xmlns="http://ws.apache.org/ns/synapse" name="send_to_all">
   <clone sequential="false">
      <target endpoint="endpoint1"/>
      <target endpoint="endpoint2"/>
      <target endpoint="endpoint3"/>     
   </clone>
   <drop/>
</sequence>
Chanaka udaya
  • 5,134
  • 4
  • 27
  • 34