Getting SI Running with MI in Five Minutes¶
This quick start guide explains how to trigger an integration flow using a message received by the Streaming Integrator.
In this example, the same message you send to the Micro Integrator goes through the inSeq
defined, and uses the respond
mediator to send back the response to the Streaming integrator.
Before you begin:
- Download and install both the Streaming Integrator and the Streaming Integrator Tooling from here.
- Download and install both the the Micro Integrator from here.
- Start the Streaming Integrator via one of the following methods depending on your operating system.
- On MacOS/Linux/CentOS, open a terminal and issue the following command:
sudo wso2si
- On windows, go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator. This opens a terminal. Start Streaming Integrator profile.
- On MacOS/Linux/CentOS, open a terminal and issue the following command:
- Start the Streaming Integrator Tooling via one of the following methods depending on your operating system..
- On MacOS/Linux/CentOS, open a terminal and issue the following command:
sudo wso2si-tooling-<VERSION>
- On windows, go to Start Menu -> Programs -> WSO2 -> Streaming Integrator Tooling. A terminal opens.
- On MacOS/Linux/CentOS, open a terminal and issue the following command:
To create and deploy Siddhi application that triggers an integration flow, and then try it out by sending events, follow the procedure below:
-
Access Streaming Integrator Tooling via the URL printed in the start up logs.
Info
The default URL is http://localhost:9390/editor.
The Streaming Integrator Tooling opens as follows.
-
Open a new Siddhi file by clicking New. Then copy and paste the following Siddhi application to it.
@App:name("grpc-call-response") @App:description("This siddhi app triggers integration flow from SI to MI") @source(type='http', receiver.url='http://localhost:8006/inputstream', @map(type = 'json')) define stream InputStream (message String, headers string); @sink(type='grpc-call', publisher.url = 'grpc://localhost:8888/org.wso2.grpc.EventService/process/inSeq', sink.id= '1', headers='{{headers}}', @map(type='json')) define stream FooStream (message String, headers string); @source(type='grpc-call-response', sink.id= '1', @map(type='json')) define stream BarStream (message String, headers string); @sink(type='log') define stream OutputStream (message String, headers string); from InputStream select * insert into FooStream; from BarStream select * insert into OutputStream
-
Save the Siddhi application.
-
Click the Deploy menu option and then click Deploy to Server. The Deploy Siddhi Apps to Server dialog box opens as shown in the example below.
-
In the Add New Server section, enter information as follows:
Field Value Host Your host Port 9443
User Name admin
Password admin
Then click Add.
-
Select the check boxes for the grpc-call-response.siddhi Siddhi application and the server you added as shown below.
-
Click Deploy.
When the Siddhi application is successfully deployed, the following message appears in the Deploy Siddhi Apps to Server dialog box.
As a result, the
grpc-call-response.siddhi
Siddhi application is saved in the<SI_HOME>/wso2/server/deployment/siddhi-files
directory. -
-
Deploy the required artifacts in the Micro Integrator as follows:
-
Save the following GRPC inbound endpoint as
grpcInboundEndpoint.xml
in the<MI_Home>/repository/deployment/server/synapse-configs/default/inbound-endpoints
directory.
!!! info Currently, WSO2 Integration Studio does not support GRPC Inbound Endpoint. This capability will be available in a future release. For now, you need to create the inbound endpoint manually as an XML file.<?xml version="1.0" encoding="UTF-8"?> <inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="GrpcInboundEndpoint" sequence="inSeq" onError="fault" protocol="grpc" suspend="false"> <parameters> <parameter name="inbound.grpc.port">8888</parameter> </parameters> </inboundEndpoint>
-
Save the following sequence that includes a
respond
mediator in the<MI_Home>/repository/deployment/server/synapse-configs/default/sequences
directory. You can name the fileInSeq.xml
.<?xml version="1.0" encoding="UTF-8"?> <sequence xmlns="http://ws.apache.org/ns/synapse" name="inSeq"> <log level="full"/> <respond/> </sequence>
-
-
Issue the following CURL command to send an event to the Streaming Integrator. This is received via the
http
source configured in thegrpc-call-response
Siddhi application, and it triggers an integration flow with the Micro Integrator.curl -X POST -d "{\"event\":{\"message\":\"http_curl\",\"headers\":\"'Content-Type:json'\"}}" http://localhost:8006/inputstream --header "Content-Type:application/json"
The following response is logged in the console in which you are running the SI server.
INFO {io.siddhi.core.stream.output.sink.LogSink} - HelloMi : OutputStream : Event{timestamp=1573188022317, data=[http_curl, 'Content-Type:json'], isExpired=false}