Universal Messaging 10.5 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for Python | Enterprise Client Development | Publishing Events to a Channel or Queue
 
Publishing Events to a Channel or Queue
Once the NirvanaSession has been established with the Universal Messaging realm server, a new Universal Messaging Event object (nConsumeEvent) must be constructed prior to use in the publish call being made to the channel.
Note that in this example code, we also create a Universal Messaging Event Dictionary object (nEventDictionary) for our Universal Messaging Event before publishing it:

chanName = "demoChannel"
props = nEventProperties()
props.put("exampleKey", "Hello World")
event = nConsumeEvent(props,"aTag")

mySession.publish(chanName,event)
Note that there is no Universal Messaging Channel or Queue object, you simply pass the name of the destination (channel or queue) to the publish method.
The underlying library (written using the Universal Messaging C++ API) will find the Channel or Queue object the first time the destination is accessed. So if you pass the name of a Channel which does not exist then you will receive an exception.
Other than initially finding the channel, publish calls are asynchronous so the publish call will immediately return allowing the client to continue. This means that if there is an exception on the server e.g. the client does not have permission to publish to the destination, there will be no client side exception unless you use an asynchronous exception listener.