com.apama
Type Channel


A destination for events, either a channel name or a context identifier.

Values of the Channel type are objects that hold either a string, which is a channel name, or a context object depending on how you construct it.

The Channel type lets you send an event to a channel or context. If the Channel object contains a string, then the event is sent to the channel with that name. If the Channel object contains a context, then the event is sent to that context.

A channel can either be constructed from a string or a context, or it can be initialized to empty, which is the default value. This is equivalent to creating it from an empty context. Attempting to send an event to an empty Channel or a Channel containing an empty context will throw an exception.

The benefit of using a Channel object rather than a string or context object is that the Channel object is polymorphic. For example, by using a Channel object to represent the source of a request, you could write a service monitor so that the same code sends a response to a service request. You would not need to have code for sending responses to channels and separate code for sending responses to contexts.

You cannot send an event to a sequence of Channel objects. You cannot route a Channel object, but a routable object can have a Channel object as a member. Channel objects are parseable, comparable and acyclic.
Action summary
 booleanstatic canParse(string s)

Check if the string argument can be parsed as a channel.
 com.apama.Channelstatic parse(string s)

Parse a string as a channel.
 com.apama.Channelclone()

Create a deep copy of this channel.
 booleanempty()

Check if this channel contains a valid destination (this is a legacy alias for the isEmpty() method).
 integerhash()

Get an integer hash representation of the underlying object.
 booleanisEmpty()

Check if this channel contains a valid destination.
 stringtoString()

Convert the channel to a string.
 
Action detail

canParse

boolean static canParse(string s)
Check if the string argument can be parsed as a channel.
Parameters:
s - The string to test for parseability.
Returns:
True if the string could be parsed as a channel, false otherwise.
See Also:
 - See the parse method for what is parseable.

parse

com.apama.Channel static parse(string s)
Parse a string as a channel.

Channels are represented as "com.apama.Channel(" contents ")". The contents is either a quoted string for the channel name, or it is the string form of a context.

You cannot parse the string representation of a channel that contains a context, only channels that contain string channel names.
Parameters:
s - The string to parse.
Returns:
The channel parsed from the string.
Throws:
Throws ParseException if the string cannot be parsed as a channel or it is a channel containing a context.

clone

com.apama.Channel clone()
Create a deep copy of this channel.
Returns:
A deep copy of this channel.

empty

boolean empty()
Check if this channel contains a valid destination (this is a legacy alias for the isEmpty() method).
Returns:
True if this channel contains an empty context, false otherwise.
See Also:
 - The recommended way to call this.

hash

integer hash()
Get an integer hash representation of the underlying object.

This function will return an integer evenly distributed over the whole range suitable for partitioning or indexing of that structure. Multiple different object can resolve to the same hash value.
Returns:
An integer respresentation of the underlying object.

isEmpty

boolean isEmpty()
Check if this channel contains a valid destination.
Returns:
True if this channel contains an empty context, false otherwise.
Since:
10.15.4.0

toString

string toString()
Convert the channel to a string.

Channels are represented as "com.apama.Channel(" contents ")". The contents is either a quoted string for the channel name, or it is the string form of a context.
Returns:
The string form of the channel.
See Also:
 - See the toString method on context for the string form of contexts.