Package com.caplin.datasource.channel
Interface Channel
public interface Channel
Channel
s provide a bi-directional communication mechanism between StreamLink clients
and DataSource applications. Messages on a channel take the form of
RecordMessage
s that can be sent by either the
DataSource or the StreamLink client. An example use of Channel
would be to implement
a trade messaging channel.
A channel is identified by its subject and the DataSource Peer
(for
example, a Liberator) that opened the channel. In deployment, this means that it is possible for
two channels to exist with identical subjects but they are differentiated by the
Peer
s that opened them.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a Generic Message with the subject of this channel.Creates a type 1 record message with the subject of this channel.getPeer()
Gets the peer that opened the channel.Gets the subject of this channel.void
sendMessage
(RecordMessage message) Sends a record message to the peer that opened the channel.void
sendRecordMessage
(RecordMessage message) Deprecated.use sendMessage insteadvoid
sendSubjectError
(String subject, SubjectError error) Sends a subject error event to the peer that opened the channel.void
sendSubjectStatus
(String subject, SubjectStatus subjectStatus, String statusMessage) Sends a subject Status event to the peer that opened the channel.
-
Method Details
-
getSubject
String getSubject()Gets the subject of this channel.- Returns:
- The subject.
-
getPeer
Peer getPeer()Gets the peer that opened the channel.- Returns:
- The peer.
-
createMessage
GenericMessage createMessage()Creates a Generic Message with the subject of this channel.- Returns:
- The new
GenericMessage
.
-
sendMessage
Sends a record message to the peer that opened the channel.- Parameters:
message
- TheRecordMessage
to be sent.
-
createRecordMessage
RecordType1Message createRecordMessage()Creates a type 1 record message with the subject of this channel.- Returns:
- The new
RecordType1Message
.
-
sendRecordMessage
Deprecated.use sendMessage insteadSends a record message to the peer that opened the channel.- Parameters:
message
- TheRecordMessage
to be sent.
-
sendSubjectError
Sends a subject error event to the peer that opened the channel.- Parameters:
subject
- The subject to send the subject error to.error
- TheSubjectError
to be sent.
-
sendSubjectStatus
Sends a subject Status event to the peer that opened the channel.- Parameters:
subject
- The subject to send the subject error to.statusMessage
- The statusMessage to send to the peer.subjectStatus
- TheSubjectStatus
to be sent.
-