Universal Messaging 10.11 | Administration Guide | Using Command Central to Manage Universal Messaging | Using the Command Line to Manage Universal Messaging | Event Publishing | Publish Events
 
Publish Events
Publishes an event on a channel or queue.
Syntax
*To publish an event on a channel:
cc exec administration component nodeAlias Universal-Messaging-instanceName
channels publish name=channelName data=eventContent [tag=eventTag] [ttl=ttlValue]
[persistent={true|false}] [transient={true|false}] [properties=propertiesString]
[pubcount=publishCount] [sendasprotobuf={true|false}] [protobufdescriptor=protobufDescriptor]
*To publish an event on a queue:
cc exec administration component nodeAlias Universal-Messaging-instanceName
queues publish name=queueName data=eventContent [tag=eventTag] [ttl=ttlValue]
[persistent={true|false}] [properties=propertiesString]
[pubcount=publishCount] [sendasprotobuf={true|false}] [protobufdescriptor=protobufDescriptor]
Arguments and Options
nodeAlias
Required. The alias name of the installation in which the Universal Messaging server instance is installed.
Universal-Messaging-instanceName
Required. The ID of the Universal Messaging server instance on which you want to publish an event.
name=channelName
Required for publishing an event on a channel. The name of the channel on which you want to publish an event.
name=queueName
Required for publishing an event on a queue. The name of the queue on which you want to publish an event.
data=eventContent
Required. The content of the event.
[tag=eventTag]
Optional. The tag of the event.
[ttl=ttlValue]
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. Supported only for channels. Whether the event is transient. Values are:
*true
*false (default)
[properties=propertiesString]
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=publishCount]
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)
For more information about working with Protobuf events, see Google Protocol Buffers.
[protobufdescriptor=protobufDescriptor]
Required for Protobuf events. The Protobuf file descriptor that defines the messaging schema to be used for converting the event content in the data option to a Protobuf event.
For more information about working with Protobuf events, see Google Protocol Buffers.
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 Channels or Queues.
*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.
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
}
}
}