This information details the new ENS C API in Messaging Server 7 Update 4.
The ENS C API, ens.h, is located in the msg-server-base/examples/enssdk/ directory. The ens_pub.c sample publisher and ens_sub.c sample subscriber demonstrate use of the ENS C API.
Here is the API header (ens.h):
The client calls ens_open() to start a connection. If reliability across ENS connection outages is important, the client should provide a lost connection handler callback. The lost connection handler normally marks any client-specific subscription information as invalid, calls ens_close, and triggers a task to attempt a reconnect by using ens_open (possibly after a delay).
The client calls ens_close() on shut down.
The client calls ens_subscribe() to subscribe to events and gets a callback when a matching event is received. The client calls ens_unsubscribe() to unsubscribe from an event (usually not necessary as a client can just call ens_close).
To publish an event, use ens_publish. (In general, you do not need to do so and the sample code should be sufficient.)
To build the sample programs, link against the libens library, which is normally installed in /opt/sun/comms/messaging64/lib/libens.so.
The ens_sub.c sample program is helpful to see what events are generated and how the event strings and message payloads are formatted.
Both Messaging Server publishers (that is, imapd) and the ENS server (enpd) are designed to drop events if an overload situation occurs.
Clients written against the old ENS C API (the headers and libens.so file included with Messaging Server 7 Update 3 and prior releases) should work against the new ENS daemon as long as they link against the libens.so library from Messaging Server 7 Update 3 and prior releases. However, the new API is simpler so a rewrite to the new API is recommended.
The ENS C API is presently the recommended API for C-based software that needs to subscribe to Messaging Server events. Use of the Glassfish Message Queue, OpenMQ, or Java Enterprise System Message Queue C API is not recommended.