public abstract class BaseChannel extends java.lang.Object implements Channel
BaseChannel
represents a channel or a transport to which BE can connect, and which can receive and send BE
Event
objects.
Each Channel
instance has a set of BaseDestination
, each of which
represent an end-points that the transport can use.
init()
-> connect()
-> start()
-> close()
Users must take care of this sequence while providing the Channel's implementation
connect()
- Default implementation connects to all of the underlying destinations
start()
- Default implementation starts all of the underlying destinations
close()
- Default implementation closes all of the underlying destinations
If needed user can override these methods and provide own implementation
Modifier and Type | Field and Description |
---|---|
protected CustomChannelConfig |
config
Stores the configuration of this Channel.
|
protected java.util.Map |
destinations
Stores all the
Destination instances for this Channel . |
protected java.lang.String |
uri
Stores the location of the channel in its containing project.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
A life cycle method used by the framework to close the channel and its associated resources.
|
void |
connect()
A life cycle method used by the framework to connect the channels's destinations to its transport.
|
java.util.Properties |
getBeProperties()
Gets BE runtime properties for use in the user channel.
|
java.util.Properties |
getChannelProperties()
Gets the channel properties as defined in its
drivers.xml for use in the user channel. |
java.util.Map |
getDestinations()
Get all the destinations of this
Channel |
java.lang.Object |
getGlobalVariableValue(java.lang.String name)
Utility method that gets the value of the Global Variable as specified in the
BE Project
that contains this Channel . |
Logger |
getLogger()
Gets the runtime Logger instance for use in the user channel.
|
java.lang.String |
getUri()
Gets the full path of the
Channel in the project. |
void |
init()
A life cycle method used by the framework to initialize the channel.
|
void |
resume()
A life cycle method used by the framework to resume the channel
This default implementation will sequentially invoke
Destination.resume() on each of its destinations. |
void |
setDestinations(java.util.Map destinations)
The framework uses this method to set the Channels destination objects
|
void |
start()
A life cycle method used by the framework to start receiving messages from its destinations.
|
void |
suspend()
A life cycle method used by the framework to suspend the channel
This default implementation will sequentially invoke
Destination.suspend() on each of its destinations. |
protected CustomChannelConfig config
protected java.lang.String uri
protected java.util.Map destinations
Destination
instances for this Channel
.public void init()
Destination.init()
User extensions should override this method to perform channel specific initializations.
If overridden, it the users responsibility to connect on each of its destinations. The overridden method can use super.connect()
to do that.
super.init()
in order to initialize its destinations.init
in interface Channel
java.lang.Exception
- : propagates the exception thrown by any of its destination's init() methodsBaseChannel.connect()
,
BaseChannel.close()
public void connect()
Destination.connect()
on each of its destinations.
If overridden, it the users responsibility to invoke connect on each of its destinations. The overridden method can use super.connect()
to do that.connect
in interface Channel
java.lang.Exception
- encountered while invoking connect on each of its destinations.BaseDestination.connect()
,
BaseChannel.init()
,
BaseChannel.close()
public void start()
Destination.start()
on each of its destinations.
If overridden, it is the users responsibility to start all its destinations. The overridden method can use super.start()
to do that.start
in interface Channel
java.lang.Exception
- encountered exceptionBaseDestination.start()
,
BaseChannel.connect()
,
BaseChannel.close()
public void close()
Destination.cose()
on each of its destinations.
If overridden, it is the users responsibility to start all its destinations. The overridden method can use super.close()
to do that.close
in interface Channel
java.lang.Exception
- encountered exceptionBaseChannel.init()
public void suspend()
Destination.suspend()
on each of its destinations.
If overridden, it is the users responsibility to suspend all its destinations. The overridden method can use super.suspend()
to do that.public void resume()
Destination.resume()
on each of its destinations.
If overridden, it is the users responsibility to resume all its destinations. The overridden method can use super.resume()
to do that.public java.lang.String getUri()
Channel
in the project.public java.util.Map getDestinations()
Channel
Map
with the String
URI of the Destination as its key and the associated Destination
as its valuepublic final void setDestinations(java.util.Map destinations)
destinations
- map of destination uri versus destinationpublic java.lang.Object getGlobalVariableValue(java.lang.String name)
BE Project
that contains this Channel
.name
- name which identifies the Global VariableGlobalVariables
of the containing BE Project
.public java.util.Properties getBeProperties()
Properties
of the BE applicationpublic java.util.Properties getChannelProperties()
drivers.xml
for use in the user channel.public Logger getLogger()
Logger
of the containing BE Project
.