Skip to content

Instantly share code, notes, and snippets.

View chanakaudaya's full-sized avatar
💭
Keep looking, don't settle

Chanaka Fernando chanakaudaya

💭
Keep looking, don't settle
View GitHub Profile
<api xmlns="http://ws.apache.org/ns/synapse" name="EmailAPI" context="/voice">
<resource methods="POST GET" uri-template="/details?email={email}">
<inSequence>
<log level="full">
<property name="EMAIL" expression="$url:email"/>
</log>
<respond/>
</inSequence>
</resource>
<resource methods="POST GET" uri-template="/phone/{number}">
<api xmlns="http://ws.apache.org/ns/synapse" name="AsterixAPI" context="/voice">
<resource methods="POST GET" uri-template="/details*">
<inSequence>
<log level="full">
<property name="EMAIL" expression="$url:email"/>
<property name="PHONE" expression="$url:phone"/>
</log>
<respond/>
</inSequence>
</resource>
@App:name("ReceiveAndCount")
@App:description('Receive events via HTTP transport and view the output on the console')
@Source(type = 'http',
receiver.url='http://localhost:8006/productionStream',
basic.auth.enabled='false',
@map(type='json'))
define stream SweetProductionStream (name string, amount double);
@App:name("AlertsAndThresholds")
@App:description('Simulate a single event and receive alerts as e-mail when a predefined threshold value is exceeded')
define stream TransactionStream(creditCardNo string, country string, item string, transaction double);
@sink(type='email',
username ='siddhi.sample',
address ='<sending_email>',
password= '<email_password>',
<?xml version="1.0" encoding="UTF-8"?><sequence xmlns="http://ws.apache.org/ns/synapse" name="mashupSeq">
<log level="full">
<property name="STATUS" value="RESP-1"/>
</log>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="response1"/>
</enrich>
<call>
<endpoint>
import ballerina/http;
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind {port:9090} {
@http:ResourceConfig {
path: "/service1",
methods: ["POST"]
}
import ballerina/http;
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind {port:9091} {
@http:ResourceConfig {
path: "/service2",
methods: ["POST"]
}
@chanakaudaya
chanakaudaya / vfsProxyS3.xml
Created July 11, 2018 06:39
This is a sample WSO2 ESB proxy service to move a file from SFTP server to an Amazon S3 bucket
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="vfsProxyS3" startOnLoad="true" statistics="disable" trace="disable" transports="vfs">
<target>
<inSequence>
<log level="full">
<property name="log" value="====VFS Proxy S3===="/>
</log>
<property expression="get-property('SYSTEM_TIME')" name="objectName"/>
<property name="contentType" value="text/plain"/>
<amazons3.init>
<accessKeyId>{wso2:vault-lookup('s3accesskey')}</accessKeyId>
@chanakaudaya
chanakaudaya / PayloadFactorySOAP12Sequence.xml
Last active June 13, 2019 05:49
WSO2 Synapse mediation sequence to build a SOAP message for SOAP 12 namespace
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="PayloadFactorySOAP12Sequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<soap:Envelope xmlns:ns="http://www.viewstar.com/webservices/2002/11" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
<ns:Login>
<ns:loginId>$1</ns:loginId>
<ns:password>$2</ns:password>
@chanakaudaya
chanakaudaya / PayloadFactorySOAP11Sequence.xml
Last active June 13, 2019 05:49
WSO2 Synapse mediation sequence to build a SOAP message for SOAP 11 namespace
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="PayloadFactorySOAP11Sequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<soap:Envelope xmlns:ns="http://www.viewstar.com/webservices/2002/11" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
<soap:Header/>
<soap:Body>
<ns:Login>
<ns:loginId>$1</ns:loginId>
<ns:password>$2</ns:password>