Madhushani Hewagama
Madhushani Hewagama

Reputation: 468

WSO2 JMS address endpoint uri with system variable

I try to create wso2 jms endpoint and the code is,

<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="canary-v1-jms-internal-topic-endpoint" xmlns="http://ws.apache.org/ns/synapse">
    <address uri="jms:/canary-internal-topic?transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616&amp;transport.jms.DestinationType=topic">
        <suspendOnFailure>
            <initialDuration>-1</initialDuration>
            <progressionFactor>1</progressionFactor>
        </suspendOnFailure>
        <markForSuspension>
            <retriesBeforeSuspension>0</retriesBeforeSuspension>
        </markForSuspension>
    </address>
</endpoint>

but here i need to change that uri by getting value from system variable. so i decide to replace tcp://localhost:61616 with $SYSTEM:TCP. The code is,

<address uri="jms:/canary-internal-topic?transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=$SYSTEM:TCP&amp;transport.jms.DestinationType=topic">

but its not working. can anyone give me the solution for it.

Upvotes: 2

Views: 284

Answers (2)

Madhushani Hewagama
Madhushani Hewagama

Reputation: 468

you can use REST_URL_POSTFIX for append required parts to end of the url using this.

Upvotes: 2

KAsara
KAsara

Reputation: 21

You can inject parameters as Environment Variables and using Configuration Files[1]. As your requirement is Injecting Parameters as Environment Variables, First you need to export the environment variable as below.

export backendEP=http://localhost:8280/services/Version

And Define the endpoint as below.

<endpoint name="backendEP">
         <address uri="$SYSTEM:backendEP"/>
</endpoint>

Sample proxy service:

<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="InjectProxy" startOnLoad="true" statistics="disable" trace="disable" transports="http,https">
<target>
    <inSequence>
        <call>
    <endpoint name="backendEP">
        <address uri="$SYSTEM:backendEP"/>
    </endpoint>
        </call>
        <respond/>
    </inSequence>
</target>
<description/>

Upvotes: 0

Related Questions