Event Publishing Commands
Important:
The event publishing commands work with Command Central 10.4 and higher.
You use the cc exec administration component command to publish and republish events on a Universal Messaging channel or queue.
To publish an event on a channel:
cc exec administration component node_alias Universal-Messaging-server_instance_name
channels publish name=channel_name data=event_content [tag=event_tag] [ttl=ttl_value]
[persistent={true|false}] [transient={true|false}] [properties=properties_string]
[pubcount=publish_count] [sendasprotobuf={true|false}]
[protobufdescriptor=protobuf_descriptor]
To republish a snooped event on a channel:
cc exec administration component node_alias Universal-Messaging-server_instance_name
channels publish name=channel_name data=event_content id=original_event_id
user=user_name republish=true [tag=event_tag] [ttl=ttl_value]
[persistent={true|false}] [transient={true|false}] [properties=properties_string]
[pubcount=publish_count] [sendasprotobuf={true|false}]
[protobufdescriptor=protobuf_descriptor] [purgeoriginal={true|false}]
To publish an event on a queue:
cc exec administration component node_alias Universal-Messaging-server_instance_name
queues publish name=queue_name data=event_content [tag=event_tag] [ttl=ttl_value]
[persistent={true|false}] [transient={true|false}] [properties=properties_string]
[pubcount=publish_count] [sendasprotobuf={true|false}]
[protobufdescriptor=protobuf_descriptor]
To republish a snooped event on a queue:
cc exec administration component node_alias Universal-Messaging-server_instance_name
queues publish name=queue_name data=event_content republish=true [tag=event_tag]
[ttl=ttl_value] [persistent={true|false}] [transient={true|false}]
[properties=properties_string] [pubcount=pub_count]
[sendasprotobuf=[{true|false}] [protobufdescriptor=protobuf_descriptor]
Arguments and Options
Argument or Option | Value |
Universal-Messaging-server_instance_name | Required. The ID of the Universal Messaging server instance on which you want to publish or republish an event. |
name=channel_or_queue_name | Required. The name of the channel or queue on which you want to publish or republish an event. |
data=event_content | Required. The content of the event. |
[tag=event_tag] | Optional. The tag of the event. |
[ttl=ttl_value] | Optional. The time-to-live (TTL) of the event in milliseconds. Defines how long the event remains available on the channel or queue. If you specify a TTL of 0, the event remains on the channel or queue indefinitely. |
[persistent={true|false}] | Optional. Whether the event is persistent. Values are: true false (default) |
[transient={true|false}] | Optional. Whether the event is transient. Values are: true false (default) |
id=original_event_id | Required when republishing an event on a channel. The ID of the original event. |
user=user_name | Required when republishing an event on a channel. The user name of the user who started snooping on the event on the channel. |
republish={true|false} | Required when republishing an event on a channel or queue. Whether to republish the snooped event. Values are: true false (default) |
[purgeoriginal={true|false}] | Optional. Whether to purge the original event from the channel. Values are: true false (default) |
[properties=properties_string] | Optional. A string that contains event properties in the following JSON format: [ { name: "property1_name", type: "property1_type", value: property1_value }, { name: "property2_name", type: "property2_type", value: property2_value }, … ] where propertyX_name is the name of the property. propertyX_type is the type of the property and can have one of the following values: int, byte, long, short, float, double, boolean, char, string, int[], byte[], long[], short[], float[], double[], boolean[], char[], and string[]. propertyX_value is the value of the property. |
[pubcount=pub_count] | Optional. The number of times to republish an event. If you omit pubcount, the option defaults to 1. |
[sendasprotobuf={true|false}] | Optional. Whether to convert the event content in the data option to a Protobuf event that matches a Protobuf schema specified in the protobufdescriptor option and already uploaded on the channel or queue. Values are: true false (default) |
[protobufdescriptor=protobuf_descriptor] | Required only for Protobuf events. The Protobuf file descriptor that defines the message schema to be used for converting the event content in the data option to a Protobuf event. |
Usage Notes
When you use the
properties option, consider the following information:
Include the
-f json option to specify the format of the properties string.
Enclose char and string property values, and values with spaces in double quotes ("). If the value contains double quotes, replace them with a backslash and double quotes (\").
For array values, specify a valid JSON array of the corresponding type.
When you want to publish a Protobuf event, consider the following information:
Before publishing a Protobuf event, you must upload on the channel or queue the Protobuf file descriptor that defines the Protobuf schema, as part of a file descriptor set. For information about uploading a Protobuf file descriptor set on a channel or queue, see
Channel Configuration or
Queue Configuration.
The value of the
data option is a JSON string that represents the Protobuf event.
The value of the
protobufdescriptor option is the name of the Protobuf file descriptor that defines the message schema.
Before republishing a snooped event on a channel or queue, you must start snooping on the channel or queue and obtain the event ID.
Examples
To publish an event with event data "CustomerOrders" and event tag "COrders" on channel "channel2" that is created on the server instance with ID "Universal-Messaging-umserver", installed in the installation with alias name "sag01":
cc exec administration component sag01 Universal-Messaging-umserver channels
publish name=channel2 data=CustomerOrders tag=COrders
To publish a persistent event with event data "CustomerOrders", event tag "COrders", and TTL "10000" three times on queue "queue1" that is created on the server instance with ID "Universal-Messaging-umserver", installed in the installation with alias name "sag01":
cc exec administration component sag01 Universal-Messaging-umserver queues
publish name=queue1 data=CustomerOrders tag=COrders ttl=10000
persistent=true pubcount=3
To publish an event with event data "CustomerOrders", event tag "COrders", and custom properties in JSON format on queue "queue1" that is created on the server instance with ID "Universal-Messaging-umserver", installed in the installation with alias name "sag01":
cc exec administration component sag01 Universal-Messaging-umserver queues
publish name=queue1 data=CustomerOrders tag=COrders
properties="[ { name: \"orderNumber\", type: \"string\", value: \"F18LP\" },
{ name: \"items\", type: \"int\", value: 3 },
{ name: \"itemIds\", type:\"int[]\", value: [ 509, 19, 100 ] } ]" -f json
To publish a Protobuf event on channel "channel2" that is created on the server instance with ID "Universal-Messaging-umserver", installed in the installation with alias name "sag01":
cc exec administration component sag01 Universal-Messaging-umserver channels
publish name=channel2
data="{ header: { id: 1, time: 1541163198345 },
contents: { intData: 124, doubleData: 3.141593, stringData: \"Software AG\" } }"
protobufdescriptor=Event sendasprotobuf=true
The example assumes that a Protobuf file descriptor set containing the following descriptors has already been uploaded on "channel2". The Protobuf event in the example is created from the "Event" message type in the file descriptor set. The event data is a valid JSON string that represents a message of type "Event" and has the same fields as the "Event" message type.
file {
name: "EventWrapper"
package: "um"
dependency: "HeaderWrapper"
dependency: "ContentsWrapper"
message_type {
name: "Event"
field {
name: "header"
number: 1
label: LABEL_REQUIRED
type: TYPE_MESSAGE
type_name: "Header"
}
field {
name: "contents"
number: 2
label: LABEL_REQUIRED
type: TYPE_MESSAGE
type_name: "Contents"
}
}
}
file {
name: "HeaderWrapper"
package: "um"
message_type {
name: "Header"
field {
name: "id"
number: 1
label: LABEL_REQUIRED
type: TYPE_INT32
}
field {
name: "time"
number: 2
label: LABEL_REQUIRED
type: TYPE_SINT64
}
}
}
file {
name: "ContentsWrapper"
package: "um"
message_type {
name: "Contents"
field {
name: "intData"
number: 1
label: LABEL_REQUIRED
type: TYPE_SINT32
}
field {
name: "doubleData"
number: 4
label: LABEL_REQUIRED
type: TYPE_DOUBLE
}
field {
name: "stringData"
number: 5
label: LABEL_REQUIRED
type: TYPE_STRING
}
}
}
To republish an event with ID "3", modified event data "CancelledCustomerOrders", and modified event tag "CCOrders", snooped by user "Administrator", on channel "channel2" that is created on the server instance with ID "Universal-Messaging-umserver", installed in the installation with alias name "sag01":
cc exec administration component sag01 Universal-Messaging-umserver channels
publish name=channel2 data=CnacelledCustomerOrders tag=CCOrders
republish=true id=3 user=Administrator