Publisher objects send messages.
This file defines publisher objects and calls that send messages.
#define TIB_PUBLISHER_PROPERTY_BOOL_RELEASE_MSGS_TO_SEND "com.tibco.ftl.client.publisher.release" |
Ownership of outbound messages; boolean.
When tibfalse
or absent, client program code retains ownership of outbound messages that it sends through this publisher.
When tibtrue
, the FTL library accepts ownership of outbound messages that the client sends through this publisher. Client code releases the message object when it invokes the send call; from that moment onward, client code must not reference the message object, because the FTL library can destroy the message object at any time.
Client code can release a message only if client owns the message. In particular, if a subscriber does not release its messages to the callback, then the callback must not send it through a publisher that releases messages. (See TIB_SUBSCRIBER_PROPERTY_BOOL_RELEASE_MSGS_TO_CALLBACK .)
See tibPublisher_Create
#define TIB_PUBLISHER_PROPERTY_DOUBLE_PERSISTENCE_CLOSE_LINGER "com.tibco.ftl.client.publisher.persistence.close.linger" |
Linger duration for persistent publisher close operation; double.
When a persistence publisher is configured for non-inline send, and a call to tibPublisher_Close is made while there are still messages waiting to be persisted, the call can be configured to wait for some time before closing the publisher. If the linger period elapses, and the messages have not been successfully persisted, the messages will be discarded. Set this property to control the linger behavior of tibPublisher_Close . The default value is 30 seconds.
Values:
-
0 Close the publisher immediately.
-
-1 Close the publisher only after it successfully persisted all outstanding messages
-
n (Any positive double value) Wait for the publisher to persist outstanding messages for at most n seconds. Proceed with closing the publisher upon success or timeout, whichever comes first.
Closing the realm supersedes and cancels linger behavior.
See tibPublisher_Create
#define TIB_PUBLISHER_PROPERTY_DOUBLE_PERSISTENCE_RETRY_DURATION "com.tibco.ftl.client.publisher.persistence.retry.duration" |
Retry duration for persistent publisher operations; double.
When tibPublisher_Create, tibPublisher_Send, or tibPublisher_SendMessages cannot access the persistence server (usually because of network failure or quorum unavailability), they can automatically retry the interaction. The value of this property overrides the retry behavior of the server. Supply it to the publisher create call.
Values:
-
0 No retry. The call raises an exception.
-
-1 Synchronously retry the interaction until it succeeds. The call returns only upon success.
-
n (Any positive double value) Retry the interaction for n seconds. Return upon success or raise an exception after timeout.
Closing the publisher or the realm supersedes and cancels retry behavior.
See tibPublisher_Create
#define TIB_PUBLISHER_PROPERTY_INT_MAX_BATCH_COUNT "com.tibco.ftl.client.publisher.max.batch" |
Maximum batch count for non-inline publishers; integer.
When a persistence publisher is configured for non-inline send, this is the maximum number of messages that may be in flight to the persistence service at any given time. When this limit is reached, tibPublisher_Send blocks until some messages can be persisted, or a failure occurs. The default value is 100.
The tibPublisher_GetMaxBatchCount call returns the value currently in effect.
See tibPublisher_Create
#define TIB_PUBLISHER_PROPERTY_INT_SEND_POLICY "com.tibco.ftl.client.publisher.send.policy" |
Publisher send policy; integer.
Optimize the publisher for lower latency or greater throughput. The default behavior depends on the realm configuration.
Values:
When publishing to a store, and the administrator has configured publisher mode store_confirm_send for the store, the inline send policy causes tibPublisher_Send and tibPublisher_SendMessages to block until the message(s) have been successfully persisted, or until a failure occurs.
When publishing to a store, and the administrator has configured publisher mode store_confirm_send for the store, the non-inline send policy changes the behavior of tibPublisher_Send .
The tibPublisher_GetSendPolicy call returns the value currently in effect.
See tibPublisher_Create
A publisher object realizes the message-sending functionality of an endpoint within a program.
A publisher object encapsulates all the information that a program needs to send a stream of messages. Publisher objects use the transport and format resources associated with an endpoint (as defined in the realm).
Programs can use a publisher to send messages one-to-many, or one-to-one.
Close a direct publisher.
Closing a direct publisher invalidates all subsequent method calls, and forces any blocked reserve calls to return.
However, closing a direct publisher does not free its memory. For more information, see "Programming with Direct Publishers" in TIBCO FTL Development.
- Parameters
-
e | The exception object captures information about failures. |
publisher | The call closes this direct publisher. |
Reserve a memory buffer for direct publishing.
This call reserves two blocks of memory: a data buffer and a size array. The application can fill the memory buffer with one or more data values, and fill the size array with the corresponding sizes (in bytes) of the data values. (In the special case that the application indicates only one data value, this call does not reserve a size array.)
A direct publisher can reserve only one buffer at a time. Subsequent reserve calls in other threads block until the application sends the reserved buffer.
After calling reserve, the application must send the reserved buffer before calling reserve again within the same thread.
To avoid blocking, which increases latency, send the buffer soon after reserving it.
The data buffer and the size array belong to the library.
- Parameters
-
e | The exception object captures information about failures. |
publisher | The call reserves memory in this publisher. |
count | The application will write this number of data items into the data buffer. The call reserves a size array of this length. Supply a positive integer. |
totalSize | The call reserves a data buffer of this size (in bytes). |
sizeArray | The call also reserves a size array, and stores the address of that array in this pointer argument. The application will fill the array with the sizes of the data values. If count is 1, indicating a single data item, supply NULL . |
- Returns
- A pointer to the data buffer.
When the publisher's send policy is non-inline, flush all outsanding messages.
When a persistence publisher is configured for non-inline send, calls to tibPublisher_Send may return before the message is persisted. Applications may call this function to ensure that all outstanding messages have been persisted (for example, if the application intends to close the publisher). This function blocks until all messages have been persisted, or until a failure occurs. If a failure occurs, this call will raise an exception.
- Parameters
-
e | The exception object captures information about failures. |
publisher | The call flushes messages previously sent using this publisher. |
- Returns
- void
Send a message, one-to-many.
If the administrator has configured publisher mode store_confirm_send for the store, a persistence publisher may block in this call until the message has been persisted. Otherwise the call returns immediately, and the message may or may not be stored.
For persistence publishers, the exact semantics depend on the send policy. See TIB_PUBLISHER_PROPERTY_INT_SEND_POLICY .
- Parameters
-
e | The exception object captures information about failures. |
publisher | The call sends the message using this publisher. |
msg | The call sends this message. |
- Returns
- void
Send an array of messages, one-to-many.
The application sends each message in the array, in order.
Sending an array of messages eliminates the overhead cost of a separate call for each message.
If the administrator has configured publisher mode store_confirm_send for the store, a persistence publisher will block in this call until all messages have been persisted. Otherwise the call returns immediately, and the messages may or may not be stored.
- Parameters
-
e | The exception object captures information about failures. |
publisher | The call sends the messages using this publisher. |
msgCount | The number of messages provided in the array. |
msgs | The call sends msgCount messages from this array. |
- Returns
- void