on 11-09-2006 12:16 PM
Hello MDM Gurus,
I've created an Updatelistener as a java-project. Now I want to deploy it to my WAS, but how can it be done? (Ofcourse deploying it with Developer Studio is working)
The solution I'm looking for is that I can start and stop in manually, but I don't know how I should deploy it then.
Can somebody help me with this?
With kind regards,
Gerwin
Hello Jansen,
how does your updatelistener work?
I need to syndicate whenever new records are added or old records updated. Kindly advice.
Best regards,
Siar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siar,
Like I said, you need to create a java-project in Developer Studio, for instance MDMListener. Create a package and add a java file ("MDMListener.java") to the project. I'll give you the code to get started. Please remember that this example code gives you a combined add and update listener. I think it must be pretty clear how to separate them. Further, I know there is something like AddSyndicationIDs in the CatalogData class, but I'm not sure if you need that one.
Next, your file should look like this:
public class MDMListener implements RecordAddedListener,RecordUpdatedListener {
private CatalogData catalog;
public MDMListener(CatalogData catalog) {
this.catalog = catalog;
}
public void recordAdded(RecordAddedEvent arg0) {
//Here arg0 contains the tablname and the recordId
// Put your code here for what your listener must do
}
public void recordUpdated(RecordAddedEvent arg0) {
//Here arg0 contains the tablname and the recordId
// Put your code here for what your listener must do
}
public static void main(String[] args) {
CatalogData catalog = new CatalogData();
//ESTABLISH A CONNECTION TO A REPOSITORY
int loginReturnCode = catalog.Login(<HOST>, <PORT>, <USER>, <PASSWORDR>, catalog.GetCodeRegion());
if (loginReturnCode == RC.RC_OK) {
System.out.println("Connected to Repository");
MDMListener myListener = new MDMListener(catalog);
catalog.AddRecordAddedListener(myListener);
catalog.AddRecordUpdatedListener(myListener);
// This is an important piece, because here it checks for changes ever 500ms
while(true) {
Thread.yield();
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
System.out.println(e1);
}
}
}
}
}
I hope this gets you on your way. Also, be aware that if you start a listener in Developer Studio, it will remain active as long as you don't stop it. So deploying or starting the same program again without stopping the previous instance will result in multiple listeners running and performing at the same time.
With kind regards,
Gerwin
Hi !
To syndicate records automatically you have to use component called MDM Syndication Server. It is stand alone component based on syndication map's, and defined ports (file system directory). For syndication server you have to provide configuration settings (file) where you set how frequently it will check for data updates in MDM repository.
Best regards, marcin
Hi Gerwin,
to have control over yours MDM listners deployed on WAS you can create Web module project in NW Developer Studio. In this project create servlet and place your listner startup and removal code in init() and destroy() methods.
Remember to set "load on startup" parameter of your servlet to 1 (or other number - if you have more than one servlet that should be initialized on application startup).
With "load on startup" parameter - on application startup your servlet will be created, and then new instance of listner can be attached to proper MDM repository event.
You can control your listner status using Visual Administrator - with Start and Stop application functions.
Second possible solution is to expose listner start / stop functions with created webservice where listners are implemented as a session EJB.
Best Regards, marcin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gerwin,
If your OS is a windows, you can create a Windows service for Java Application using many free tools available.
If you are using a *nix based system, you can create a daemon to start or stop manually/automatically.
HTH
--
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.