[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xmlblaster] XmlBlaster client recovery after crash
Dimitri.Devriendt at ses-astra.com wrote:
Hi Marcel,
I use XmlBlaster to send PtP messages from XmlBlaster client A to client B.
The messages are volatile and don't use the forcequeuing feature.
Client B uses a callback that implements the update method like :
private messageCount = 0;
public String[] update(String cbSessionId, MessageUnit[] msgUnitArr)
{
if (messageCount == 10) {
System.exit(0);
} else {
/* handle message */
}
messageCount++;
}
During the crash (simulated by the System.exit(0)), XmlBlaster server gets
an org.omg.CORBA.COMM_FAILURE and then throws the following :
[Aug 20, 2002 5:27:50 PM ERROR MsgQueue.java:294-MsgQueue:subject:B]
The queue is shutdown, putMsgs() of 1 messages failed, starting error
handling ...
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:992)
at
org.xmlBlaster.engine.queue.MsgQueue.putMsgs(MsgQueue.java:295)
at
org.xmlBlaster.engine.queue.MsgQueue.putMsg(MsgQueue.java:274)
at
org.xmlBlaster.authentication.SubjectInfo.queueMessage(SubjectInfo.java:205)
at
org.xmlBlaster.engine.RequestBroker.publish(RequestBroker.java:1009)
at
org.xmlBlaster.engine.XmlBlasterImpl.publish(XmlBlasterImpl.java:136)
at
org.xmlBlaster.protocol.corba.ServerImpl.publish(ServerImpl.java:107)
at org.xmlBlaster.protocol.corba.serverIdl.ServerPOA.
_invoke(ServerPOA.java:80)
at
org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:207)
at
org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:404)
at
org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:513)
[Aug 20, 2002 5:27:51 PM INFO RequestBroker] Publishing 1 volatile
dead letters
After the crash of client B, I restart that client (login with the same
name and password) and XmlBlaster server still throws the above mentioned
exceptions for all new sended messages.
What is wrong ?
No idea, i have made two clients (they are attached) trying
to reproduce this behaviour, but on my machine all is fine:
java org.xmlBlaster.Main
java PtpReceive
java PtpSend
(they have some options to play with - see code).
Could you please send me your code?
Which version do you use? (you should stay with
the newest cvs).
thanks for reporting,
Marcel
// xmlBlaster/demo/javaclients/PtpReceive.java
import org.jutils.log.LogChannel;
import org.xmlBlaster.util.*;
import org.xmlBlaster.client.*;
import org.xmlBlaster.client.protocol.XmlBlasterConnection;
import org.xmlBlaster.engine.helper.MessageUnit;
import org.xmlBlaster.engine.helper.Destination;
/**
* Connects to xmlBlaster with name 'receiver' and waits for updates.
*
* After the third update (abortCount) it does a System.exit and aborts (without logout)
*
* Use this client as a partner for PtpSend.java to play with xmlBlaster
*
* Invoke:
*
* java PtpReceive
*
* java PtpReceive -abortCount 3
*
* at see xmlBlaster interface
*/
public class PtpReceive
{
private final String ME = "PtpReceive";
private XmlBlasterConnection receiver = null;
private final String receiverName = "receiver";
private int counter = 0;
private int abortCount = 3;
public PtpReceive(final Global glob) {
final LogChannel log = glob.getLog(null);
abortCount = glob.getProperty().get("abortCount", 3);
try {
// setup the receiver client ...
receiver = new XmlBlasterConnection(glob);
ConnectQos qos = new ConnectQos(glob, receiverName, "secret");
ConnectReturnQos conRetQos = receiver.connect(qos, new I_Callback() {
public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
log.info(receiverName, "Receiving asynchronous message '" + updateKey.getOid() + "' in default handler");
counter++;
if (counter == abortCount)
System.exit(-1);
return "";
}
}); // Login to xmlBlaster, default handler for updates
log.info(receiverName, "Receiver connected to xmlBlaster.");
}
catch (XmlBlasterException e) {
log.error(ME, "Houston, we have a problem: " + e.toString());
}
finally {
// Wait a second for messages to arrive before we logout
try { Thread.currentThread().sleep(1000); } catch( InterruptedException i) {}
log.info(ME, "Waiting on messages, aborting after " + abortCount + " messages, or hit a key to exit");
try { System.in.read(); } catch(java.io.IOException e) {}
if (receiver != null) { receiver.disconnect(new DisconnectQos()); }
}
}
/**
* Try
*
* java PtpReceive -help
*
* for usage help
*/
public static void main(String args[]) {
Global glob = new Global();
if (glob.init(args) != 0) { // Get help with -help
XmlBlasterConnection.usage();
glob.getLog(null).info("PtpReceive", "Example: java PtpReceive -abortCount 3\n");
System.exit(1);
}
new PtpReceive(glob);
}
}
// xmlBlaster/demo/javaclients/PtpSend.java
import org.jutils.log.LogChannel;
import org.xmlBlaster.util.*;
import org.xmlBlaster.client.*;
import org.xmlBlaster.client.protocol.XmlBlasterConnection;
import org.xmlBlaster.engine.helper.MessageUnit;
import org.xmlBlaster.engine.helper.Destination;
/**
* A sender client connect to xmlBlaster,
* the sender sends PtP (point to point) messages to the client "receiver"
*
* Use this client as a partner for PtpReceive.java to play with xmlBlaster
*
* Invoke:
*
* Start this sender:
*
* java PtpSend
* (get exception if message is not delivered)
*
* java PtpSend -numSend 1000 -delay 2000
* (send 1000 messages, sleep 2 sec in between)
*
* java PtpSend -forceQueuing true
* (message is queued if user 'receiver' is offline)
*
* Start a receiver:
*
* java PtpReceive
*
*
* at see xmlBlaster interface
*/
public class PtpSend
{
private final String ME = "PtpSend";
private XmlBlasterConnection sender = null;
private final String senderName = "sender";
private final String receiverName = "receiver";
public PtpSend(final Global glob) {
final LogChannel log = glob.getLog(null);
try {
// setup the sender client ...
sender = new XmlBlasterConnection(glob);
ConnectQos qos = new ConnectQos(glob, senderName, "secret");
ConnectReturnQos conRetQos = sender.connect(qos, new I_Callback() {
public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
log.info(senderName, "Receiving asynchronous message '" + updateKey.getOid() + "' in default handler");
return "";
}
}); // Login to xmlBlaster, default handler for updates
log.info(senderName, "Sender connected to xmlBlaster.");
int numSend = glob.getProperty().get("numSend", 100);
long delay = glob.getProperty().get("delay", 2000);
log.info(ME, "Send " + numSend + " messages to '" + receiverName + "' sleeping " + delay + " millis inbetween");
for (int ii=0; ii
* java PtpSend -help
*
* for usage help
*/
public static void main(String args[]) {
Global glob = new Global();
if (glob.init(args) != 0) { // Get help with -help
XmlBlasterConnection.usage();
glob.getLog(null).info("PtpSend", "Example: java PtpSend -forceQueuing true\n");
System.exit(1);
}
new PtpSend(glob);
}
}