MessageStream provides an iteration abstraction over the results of an AMPS command such as a subscribe, a SOW query, or SOW delete. MessageStream is produced when calling Client.execute() and continues iterating over the results until the connection is closed, or the iterator is explicitly closed, or when the SOW query is ended. You can use a MessageStream as you would other Iterators, for example, using a for loop (Java 1.7):
More...
|
MessageStream | timeout (int timeout_) |
| Sets a timeout on this message stream. If no message is received with this timeout, forward iteration returns null for the next message. More...
|
|
MessageStream | conflate () |
| Causes messages on a SOW topic to be conflated by their SOW key, so that when messages are consumed the latest value for each distinct key is returned instead of every message. More...
|
|
MessageStream | maxDepth (int maxQueueDepth_) |
| Bounds the internal queue of this stream to a specified count of messages. if the consumer of this stream does not process messages in a timely fashion and this internal queue limit is reached, the AMPS client will not respond to incoming messages including acknowledgements and may become disconnected. More...
|
|
int | getMaxDepth () |
| Returns the current maximum queue depth before pushing back on the receive thread. More...
|
|
int | getDepth () |
| Returns the current count of messages queued in the MessageStream. More...
|
|
void | Dispose () |
| Disposes of the resources associated with the MessageStream. More...
|
|
void | close () |
| Closes the MessageStream by invoking the Dispose method. More...
|
|
bool | MoveNext () |
| Advances the MessageStream to the next message in the sequence. More...
|
|
void | Reset () |
| Throws a NotImplementedException as the MessageStream is a forward-only, one-time iterator and cannot be reset. More...
|
|
IEnumerator< Message > | GetEnumerator () |
| Returns the current enumerator instance for the MessageStream. More...
|
|
MessageStream provides an iteration abstraction over the results of an AMPS command such as a subscribe, a SOW query, or SOW delete. MessageStream is produced when calling Client.execute() and continues iterating over the results until the connection is closed, or the iterator is explicitly closed, or when the SOW query is ended. You can use a MessageStream as you would other Iterators, for example, using a for loop (Java 1.7):
MessageStream stream = Client.execute(new Command("sow").setTopic("/orders")).timeout(1000);
foreach(Message message in stream)
{
...
}
◆ close()
void AMPS.Client.MessageStream.close |
( |
| ) |
|
|
inline |
Closes the MessageStream by invoking the Dispose method.
This method serves as an alias for the Dispose method and is provided for convenience. It is used to close the MessageStream and release associated resources.
◆ conflate()
Causes messages on a SOW topic to be conflated by their SOW key, so that when messages are consumed the latest value for each distinct key is returned instead of every message.
- Returns
- This instance
◆ Dispose()
void AMPS.Client.MessageStream.Dispose |
( |
| ) |
|
|
inline |
Disposes of the resources associated with the MessageStream.
This method is responsible for cleaning up resources, including unsubscribing from the client, removing event handlers, and setting the internal state to Complete. It is typically called when the MessageStream is no longer needed or is being closed.
◆ getDepth()
int AMPS.Client.MessageStream.getDepth |
( |
| ) |
|
|
inline |
Returns the current count of messages queued in the MessageStream.
- Returns
- The current number of messages queued in the stream.
◆ GetEnumerator()
IEnumerator<Message> AMPS.Client.MessageStream.GetEnumerator |
( |
| ) |
|
|
inline |
Returns the current enumerator instance for the MessageStream.
- Returns
- The current enumerator instance.
◆ getMaxDepth()
int AMPS.Client.MessageStream.getMaxDepth |
( |
| ) |
|
|
inline |
Returns the current maximum queue depth before pushing back on the receive thread.
- Returns
- The internal queue depth limit, default is In32.MaxValue.
◆ maxDepth()
MessageStream AMPS.Client.MessageStream.maxDepth |
( |
int |
maxQueueDepth_ | ) |
|
|
inline |
Bounds the internal queue of this stream to a specified count of messages. if the consumer of this stream does not process messages in a timely fashion and this internal queue limit is reached, the AMPS client will not respond to incoming messages including acknowledgements and may become disconnected.
- Parameters
-
maxQueueDepth_ | The internal queue depth limit (default: unlimited) |
- Returns
- This instance
◆ MoveNext()
bool AMPS.Client.MessageStream.MoveNext |
( |
| ) |
|
|
inline |
Advances the MessageStream to the next message in the sequence.
- Returns
- True if the MessageStream successfully moves to the next message; otherwise, false.
This method is responsible for advancing the MessageStream to the next message in the sequence. It employs a forward-only, one-time iteration model. It supports a timeout mechanism to wait for the next message to be available and handles update completion in the case of messages with SOW (State of the World) keys.
◆ Reset()
void AMPS.Client.MessageStream.Reset |
( |
| ) |
|
|
inline |
Throws a NotImplementedException as the MessageStream is a forward-only, one-time iterator and cannot be reset.
- Exceptions
-
NotImplementedException | Thrown to indicate that resetting the iterator is not supported. |
◆ timeout()
Sets a timeout on this message stream. If no message is received with this timeout, forward iteration returns null for the next message.
- Parameters
-
timeout_ | The timeout value in milliseconds. |
- Returns
- This instance.
◆ Current
Message AMPS.Client.MessageStream.Current |
|
get |
Gets the current message in the stream through the Current property.
This property returns the current message in the stream by invoking the internal current() method. It is typically used in the context of iterating over a message stream, allowing access to the current message without explicitly invoking the internal method.
The documentation for this class was generated from the following file:
- AMPS.Client/MessageStream.cs