The
client group to which the
BrokerClient belongs defines the event types the
BrokerClient can publish. See
Client Groups for more information. The following example contains an excerpt from a sample application that shows the use of the
BrokerClient.canPublish method to check for event publication permission. This method simply requires an event type name.
. . .
BrokerClient c;
boolean can_publish;
. . .
/* Check publish permission */
try {
can_publish = c.canPublish("Sample::SimpleEvent");
} catch (BrokerException ex) {
System.out.println("Error on check for can publish\n"+ex);
return;
}
if (can_publish == false) {
System.out.println("Cannot publish event");
System.out.println("Sample::SimpleEvent.");
System.out.println("Make sure it is loaded in the broker and");
System.out.println("permission is given to publish it in the");
System.out.println(client_group + " client group.");
return;
}
. . .