Reputation: 1117
we are trying to setup Architecture for Application.This is first time for us.This Application is not interact with End-Users,it's for my internal computations purpose.
We have a remote DBServer
(Ms sql server azure) with 1 database name as DBTesting
. Whenever any data was modified in DBTesting
,it triggers java Application name as App1
.
Question 1:
What are the possibilities to trigger App1
.
In App1
, I am running .exe
file,which is written in C
language.It takes 20 min for evaluation. If DBTesting
is modified many times with in 20 min, it sends that many number of requests from DBTesting
to App1
.But I don't want to handle more number of requests at a time.So I want to trigger App1
in queue base. Once previous Http
request is done then only Queue will be release next HTTP request.
Question 2:
Is there any way to Implement this using Java
or any other technologies
we are interacting Database with this Link
UserName : MyUserName
Password : MyPassword
we are trying to fix these from 1 week,but we are not figure it out which way is good way.
can anyone suggest me with some tutorials, which are suitable to my requiments.
Thanks.
Upvotes: 2
Views: 4303
Reputation: 1561
You can use Active-MQ for queuing. Active MQ, Hello World
If you are using MSSQL service broker, it already provides Message Queues. you just need to figure out how to use it properly in your case.
This is link to Service Broker to JMS bridge.
Use following steps:
Part 1:
Part 2:
This link might help you indirectly.
Since Azure does not support service broker, there has to be other way to implement part1.
Part1 (Implement below steps in way possible ):
Step 1. Generate request-data(not message, just data) when database changes.
I want to send modified or new data with request from DB to Java Application
Step 2. Create messages from data generated.
Step 3. Read messages and send them to queue.
send messages including data to Queue
message Structures:
The following message points to Application1
.
App1?data="1,2,3,4,5,6,7,8,9,10..."
The following message points to Application2
.
App2?data="1,2,3,4,5,6,7,8,9,10..."
If it allow to mention our own custom message,then I will create one more table in DB.This table have 2 columns.1 row points to ApplicationName and 2 row points to message Name.It is useful while forwarding time.
Part 2(As of now remains same):
Xml Structure is in the following way.
<Message>
<Message-Body>
<Message-Context>App1</Message-Context>
<URL>`http://localhost:8080/App1`</URL>
</Message-Body>
<Message-Body>
<Message-Context>App2</Message-Context>
<URL>`http://localhost:8080/App2`</URL>
</Message-Body>
</Message>
Upvotes: 1
Reputation: 441
The easy way would be have a table in your DB with the Http Requests and a program running queries, when finds a result make the request if not sleep.
while(true){
//query the DB
if (have_results){
//http request
// remove request from the DB
}else{
// sleep 1s
}
}
it isn't code but It should be easy.
Thanks
Upvotes: 0