[muscle] Re: How to delete messages with the Java API?

  • From: Jeremy Friesner <jaf@xxxxxxxxxxxx>
  • To: "Vasconcelos Jimenez Dario" <PORYVJD1@xxxxxxxxxxxxxxxxx>
  • Date: Thu, 7 Oct 2004 13:43:30 -0700

Hi Dario,

On Thursday 07 October 2004 13:24, you wrote:
> it appears that all messages I send to muscle@xxxxxxxxxxxxx show up
> garbled, at least in my e-mail client. Can you read my last two messages or
> is it a generalised problem?

Nope, they were garbled for me too.  :^(  It looks like maybe
your email client is trying to Base64 encode them or something?
I haven't seen that happen with anyone else's posts, so that
suggests to me that the problem is on your end.

> Yes, I'm using PR_COMMAND_SETDATA as the what field, then sending it with
> the sendOutgoingMessage method of the MessageTransceiver. Another process,
> which runs in a scheduled fashion, must delete all messages older than one
> week. I'm using PR_COMMAND_REMOVEDATA. The problem is, I've tried lots of
> combinations for the value of PR_NAME_KEYS so I delete the messages from
> the database, but none has worked so far.

The PR_COMMAND_REMOVEDATA command does need to be sent by
the same client that sent the original PR_COMMAND_SETDATA Messages, or
it won't work.  Just for sanity-checking, here are some example invocations:

// Example 1:  This code removes the node named "jeremy" from 
// the client's subtree.  (Note that the first two levels of the node 
// path are implicit -- hence no initial slash, IP address, or session ID 
// need to be included in the PR_NAME_KEYS string.  This is similar to
// the "current directory" concept in filesystems)
Message msg = new Message(PR_COMMAND_REMOVEDATA);
msg.setString(PR_NAME_KEYS, "jeremy");
mc.sendOutgoingMessage(msg);

// Example 2:  This code removes the node named "jeremy" and the node 
// named "dario" from the client's subtree.
Message msg = new Message(PR_COMMAND_REMOVEDATA);
String [] keys = {"jeremy", "dario"};
msg.setStrings(PR_NAME_KEYS, keys);
mc.sendOutgoingMessage(msg);

// Example 3:  This code removes all the children of the node named 
// "log_directory" whose names start with the prefix "tuesday_".
Message msg = new Message(PR_COMMAND_REMOVEDATA);
msg.setString(PR_NAME_KEYS, "log_directory/tuesday_*");
mc.sendOutgoingMessage(msg);

// This code removes all of this client's database nodes!
Message msg = new Message(PR_COMMAND_REMOVEDATA);
msg.setString(PR_NAME_KEYS, "*")
mc.sendOutgoingMessage(msg);

> I have also tried to delete the messages from the originating client, with
> the same results.

That is necessary... client A is not allowed to delete nodes that were
posted by client B.

> I _know_ I'm doing something wrong. Maybe the way I'm sending them?

Does your code look like the examples above?   Feel free to send me a code 
snippet if you want.

Jeremy

Other related posts:

  • » [muscle] Re: How to delete messages with the Java API?