/* put some properties into the messages */
message.put("Synchronus message",new Integer(i));
/* send the message */
System.out.println(getName() + " sending a synchronus event with message:" +
message.toString() + "and the topic:" + topicsToSend[i]);
eventAdmin.sendEvent(new Event(topicsToSend[i], message));
}catch(Exception e){
System.out.println("Error when publishing synhronous" + e);
}
}
}
};
synchDeliver.start();
/* wait until thread is dead */
synchDeliver.join();
Thread asynchDeliver = new Thread() {
public void run() {
for (int i = 0; i < messageTosend; i++) {
try{
/* create the hasht table */
Dictionary message = new Hashtable();
/* create the message */
message.put("Asynchronus message",new Integer(i));
/* Sends a synchronous event to the admin */
System.out.println(getName() + " sending an Asynchronus event with message:" +
message.toString() + "and the topic:" + topicsToSend[i]);
eventAdmin.postEvent(new Event(topicsToSend[i], message));
}catch(Exception e){
System.out.println("Error when publishing asynhronous:" +e );
}
}
}