Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to propogate Configuration changes to different servers

 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a situation where in i will make changes to Database in one server but those changes need to be propogated to other application servers connecting to same database. Servers should know that Database has changed and they need to refresh their data automatically.

we at AT&T use tomcat servers and oracle with struts2 framework.
Can i get some help on this please?

Thanks
Anil
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of changes does the database go through? Just data updates or something else?
 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have application level configurations in database and if we change them they need to be updated for all servers which are running in different machines but connecting to same DB automatically. DB changes will be data/Strings.

Anil
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How frequent the data will be refreshed?

How about going for Scheduler APIs like Quatrz?

In our case, we dont have frequent config changes, so we restart the application whenever required.
 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah for us too changes will not be so frequent but if they change requirement is that Users should not know that there is a change and it should be under wraps. thought of using Quartz but we have some restrictions on that.
Thought of using openMQ to send message to servers once db update happens and they should read it and should update them selfs but not sure how feasible it is.
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MQ is used effectively across different areas, given your case I am not sure if Database can automatically trigger a process (but DBAs can help in this), that would refresh your application.

If DB cannot trigger a Java process,
1. it is easy restart the application to get the latest.
2. Post a message to a queue through a client
3. Have a job that runs on a schedule.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation where in i will make changes to Database in one server but those changes need to be propogated to other application servers connecting to same database. Servers should know that Database has changed and they need to refresh their data automatically.


So this data is read once and then cached on the application? Use a Topic to propagate the data change.
Post to a topic on a JMS server and have an mdb on each server listening to the topic.
The MDBs react to receiving the message by forcing a reload of the db cache.
It's a common enough pattern.

ram.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shinelin Samuel wrote:2. Post a message to a queue through a client


It has to be a topic to be received by all the servers in the cluster.

ram.
 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As my application runs on tomcat i cant use MDB's. And i cant restart my application as it is against my requirement.
So very limited options for me. Any ideas of invoking URL from oracle triggers?
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not an expert in Oracle
anyways, I googled something for you, Hope this helps..

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7004.htm
http://download.oracle.com/docs/cd/B28359_01/java.111/b31225/chone.htm
 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys for your replies. I got a work around. We are going to use wget URL to invoke application from database trigger which will take care of populating those data background.

Thanks for your time.

Anil
 
anilkumar potu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another solution will be have this code to call specific URL's

URL url;
InputStream inputStream = null;
DataInputStream dataInputStream;
String inputLine;
url = new URL("http:/........");
inputStream = url.openStream();
dataInputStream = new DataInputStream(new BufferedInputStream(inputStream));
while ((inputLine = dataInputStream.readLine()) != null)
{
System.out.println(inputLine);
}
That works

Thanks
Anil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic