CASE:
One of most commonly used mechanism/component in many of the integration projects is JMS queue to send the messages back and forth among participating applications at the same time they will run into different issues like configuring JMS queue or constructing JMS Adapter etc... and the current topic is a bit different from our regular issues.
In real time integration's most of the call outs to web services will occurs on a particular event in that case sending the payload to web service ends source application responsibility after that it is receiver web service responsibility to hold the received payload and ensure that data is delivered successfully.
Scenario:
One of the scenario I have faced was source application delivers the data to my web-service upon an event and I need to enrich this and have to send across multiple participating applications in this integration where we need to convert the data into corresponding format which can be accepted by destination systems.
In this scenario, as soon as I receive the data from source application I used to store data in JMS queue which is created on Weblogic server where SOA resides.
Now the problem is after de-queue the data from this queue any of the end-systems may be down in that case my data will be sent to only to the applications which were up and running i.e. I can't keep all the participating applications in sync.
So, to over come this problem, I selected a synchronous BPEL service which as soon as de-queue the data from above mentioned JMS queue I will check all the participating end-system's are up and running or not.
Here you need to have a switch condition to decide whether data has to proceed further with processing or rollback to JMS queue.
If end-systems are up proceed with data enrichment and send data to end-systems finally you can reply some dummy value to JMS queue.
otherwise, if end-system is down have a throw activity which will rollback the data to JMS queue.
example:-
step1: check end system web service is up or not using java activity.
String serviceURL=(String)getVariableData("EndPoint");
java.net.URL serverAddress=null;
java.net.HttpURLConnection connection = null;
int st=0;
try {
serverAddress = new java.net.URL(serviceURL);
connection = (java.net.HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setReadTimeout(10000000);
connection.connect();
st=connection.getResponseCode();
st=connection.getContentLength();
setVariableData("endPointStatus",st);
} catch (Exception e) {
e.printStackTrace();
setVariableData("endPointStatus",st);
}
step2: Take the output into a local bpel variable using assing activity
Step3: Switch condition to decide which flow to choose.
If endsystem returns "-1" use "throw activity" which will rollback the data to JMS queue.
otherwise, data process further to deliver to end-systems.
Note:-
1) This is as part of my requirement I have chosen this approach, this still have some limitations which I am fine with.
2) Thanks to Srinivas Adusumalli for helping me on this.
One of most commonly used mechanism/component in many of the integration projects is JMS queue to send the messages back and forth among participating applications at the same time they will run into different issues like configuring JMS queue or constructing JMS Adapter etc... and the current topic is a bit different from our regular issues.
In real time integration's most of the call outs to web services will occurs on a particular event in that case sending the payload to web service ends source application responsibility after that it is receiver web service responsibility to hold the received payload and ensure that data is delivered successfully.
Scenario:
One of the scenario I have faced was source application delivers the data to my web-service upon an event and I need to enrich this and have to send across multiple participating applications in this integration where we need to convert the data into corresponding format which can be accepted by destination systems.
In this scenario, as soon as I receive the data from source application I used to store data in JMS queue which is created on Weblogic server where SOA resides.
Now the problem is after de-queue the data from this queue any of the end-systems may be down in that case my data will be sent to only to the applications which were up and running i.e. I can't keep all the participating applications in sync.
So, to over come this problem, I selected a synchronous BPEL service which as soon as de-queue the data from above mentioned JMS queue I will check all the participating end-system's are up and running or not.
Here you need to have a switch condition to decide whether data has to proceed further with processing or rollback to JMS queue.
If end-systems are up proceed with data enrichment and send data to end-systems finally you can reply some dummy value to JMS queue.
otherwise, if end-system is down have a throw activity which will rollback the data to JMS queue.
example:-
String serviceURL=(String)getVariableData("EndPoint");
java.net.URL serverAddress=null;
java.net.HttpURLConnection connection = null;
int st=0;
try {
serverAddress = new java.net.URL(serviceURL);
connection = (java.net.HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setReadTimeout(10000000);
connection.connect();
st=connection.getResponseCode();
st=connection.getContentLength();
setVariableData("endPointStatus",st);
} catch (Exception e) {
e.printStackTrace();
setVariableData("endPointStatus",st);
}
step2: Take the output into a local bpel variable using assing activity
Step3: Switch condition to decide which flow to choose.
If endsystem returns "-1" use "throw activity" which will rollback the data to JMS queue.
otherwise, data process further to deliver to end-systems.
Note:-
1) This is as part of my requirement I have chosen this approach, this still have some limitations which I am fine with.
2) Thanks to Srinivas Adusumalli for helping me on this.
No comments:
Post a Comment