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

  • From: Jeremy Friesner <jaf@xxxxxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Thu, 7 Oct 2004 11:21:05 -0700

Hi Dario,

Can you clarify your question for me?  I'm not sure if by "delete a Message", 
you mean

A) You have set a Message node to the server-side database using
     a PR_COMMAND_SETDATA Message, and now you want to remove
     that node from the database.

B) You have put a Message into your client's upload-queue with
     sendOutgoingMessage(), so that it is scheduled to be sent to the server,
     but soon afterwards (i.e. before the actual bytes were transmitted) 
     your program decided that you didn't want to send the Message after all,
     and you want to know how you can remove that Message from the queue so
     that it doesn't get sent.

C)  Something else?

(If the answer is A, then the PR_COMMAND_REMOVEDATA Message
is the one you want to use... see the docs for details.  If you meant B, that 
isn't directly supported by the Java implementation, but it is possible to do 
-- let me know and I can explain further)

On Thursday 07 October 2004 10:58, Vasconcelos Jimenez Dario wrote:
> Hi All,
> I have a muscled server that I'm using as message hub. I've been trying to
> delete messages that I sent, but I can't seem to get it right. AFAIK, there
> are no restrictions on who can delete a message (or should the sender do
> it?), and the code should be pretty straightforward.

If you are using PR_COMMAND_SETDATA to post Message nodes to the database, 
then:  each client's subtree is writeable only by that client -- other 
clients may read from that subtree, but not modify it.  So only the clientwho 
uploaded a node is able to delete it.

If you are just sending Messages with typecodes other than PR_COMMAND_*, then 
there is no need to delete those Messages, since they won't persist on the 
server anyway -- they just go to the other clients (if any), and then they 
are gone.

> I'm actually using the
> TestClient that comes with the java API, but I don't know if that code
> works (sending messages from it doesn't seem to work) or if I should do any
> changes. Anyone has a working example of this? It doesn't matter if it's
> written in C++...

TestClient ought to work (although I don't have a Java environment set up 
anymore, so I haven't tested it for a while)....  try running it and typing


(i.e. capital-P, return) as a command to send... that should cause the server 
to respond with a Message containing some server statistics information.  If
that works, then TestClient is working -- if not, something is wrong.


Other related posts: