public interface ChannelFactory
Transport.
The usual way of using ChannelFactory is as follows:
ChannelFactory channelFactory = new JMFChannelFactory();
channelFactory.start();
RemotingChannel remotingCannel = channelFactory.newRemotingChannel("remoting", "http://localhost:8080/myapp/graniteamf/amf.txt");
MessagingChannel messagingChannel = channelFactory.newMessagingChannel("messaging", "http://localhost:8080/myapp/gravityamf/amf.txt");
MessagingChannel websocketChannel = channelFactory.newMessagingChannel(ChannelType.WEBSOCKET, "websocket", "ws://localhost:8080/myapp/websocketamf/amf");
| Modifier and Type | Method and Description |
|---|---|
ContentType |
getContentType()
The encoding (AMF or JMF) for this ChannelFactory
|
java.lang.Object |
getContext()
A generic context object used to create transports (actual type of the context depends on the
Platform) |
java.lang.String |
getDefaultChannelType()
Return the default type of messaging channels (initially ChannelType.LONG_POLLING)
|
long |
getDefaultTimeToLive()
The default time to live defined for channels created by this factory
|
Transport |
getMessagingTransport()
The default transport for messaging channels
|
Transport |
getMessagingTransport(java.lang.String channelType)
The transport for the specified messaging channel type
|
java.util.Map<java.lang.String,Transport> |
getMessagingTransports()
The transports for messaging channels
|
Transport |
getRemotingTransport()
The transport for remoting channels
|
MessagingChannel |
newMessagingChannel(java.lang.String id,
ServerApp serverApp)
Create a messaging channel of the default type using the specified server application definition
|
MessagingChannel |
newMessagingChannel(java.lang.String id,
java.lang.String uri)
Create a messaging channel of the default type using the specified uri
|
MessagingChannel |
newMessagingChannel(java.lang.String channelType,
java.lang.String id,
ServerApp serverApp)
Create a messaging channel of the specified type using the specified server application definition
|
MessagingChannel |
newMessagingChannel(java.lang.String channelType,
java.lang.String id,
java.lang.String uri)
Create a messaging channel of the specified type using the specified uri
|
MessagingChannel |
newMessagingChannel(java.lang.String channelType,
java.lang.String id,
java.net.URI uri)
Create a messaging channel of the specified type using the specified
URI |
MessagingChannel |
newMessagingChannel(java.lang.String id,
java.net.URI uri)
Create a messaging channel of the default type using the specified
URI |
RemotingChannel |
newRemotingChannel(java.lang.String id,
ServerApp serverApp)
Create a remoting channel using the specified server application definition
|
RemotingChannel |
newRemotingChannel(java.lang.String id,
ServerApp serverApp,
int maxConcurrentRequests)
Create a remoting channel using the specified server application definition
|
RemotingChannel |
newRemotingChannel(java.lang.String id,
java.lang.String uri)
Create a remoting channel using the specified uri
|
RemotingChannel |
newRemotingChannel(java.lang.String id,
java.lang.String uri,
int maxConcurrentRequests)
Create a remoting channel using the specified uri
|
RemotingChannel |
newRemotingChannel(java.lang.String id,
java.net.URI uri)
Create a remoting channel using the specified
URI |
RemotingChannel |
newRemotingChannel(java.lang.String id,
java.net.URI uri,
int maxConcurrentRequests)
Create a remoting channel using the specified
URI |
void |
setAliasRegistry(AliasRegistry aliasRegistry)
The alias registry for this factory
|
void |
setContext(java.lang.Object context)
Set the current context used to create transports (actual type of this context depends on the
Platform) |
void |
setDefaultChannelBuilder(ChannelBuilder channelBuilder)
Set the default builder for channels
A custom channel builder can also be defined to change the default url mappings of the remoting and messaging channels
|
void |
setDefaultChannelType(java.lang.String channelType)
Set the default type of messaging channels (initially ChannelType.LONG_POLLING)
|
void |
setDefaultTimeToLive(long defaultTimeToLive)
Set the default time to live for the channels created by this factory
|
void |
setMessagingTransport(java.lang.String channelType,
Transport messagingTransport)
Set the transport for the specified messaging channel type
|
void |
setMessagingTransport(Transport messagingTransport)
Set the default transport for messaging channels
|
void |
setRemotingTransport(Transport remotingTransport)
Set the transport for remoting channels
|
void |
setScanPackageNames(java.util.Set<java.lang.String> packageNames)
Set of package names to scan
The classes of these packages will be scanned during the start of this factory to find aliased classes
|
void |
start()
Start this ChannelFactory
Must be called before trying to create channels and after all properties have been set.
|
void |
stop()
Stop this ChannelFactory
All defined transports are also stopped and unregistered.
|
void |
stop(boolean stopTransports)
Stop this ChannelFactory
Optionally when stopTransports is true all defined transports are also stopped and unregistered.
|
ContentType getContentType()
ContentTypelong getDefaultTimeToLive()
void setDefaultTimeToLive(long defaultTimeToLive)
defaultTimeToLive - time to live in millisecondsjava.lang.Object getContext()
Platform)Transportvoid setContext(java.lang.Object context)
Platform)context - current contextTransportvoid setDefaultChannelType(java.lang.String channelType)
channelType - default type of messaging channelsChannelTypejava.lang.String getDefaultChannelType()
void setDefaultChannelBuilder(ChannelBuilder channelBuilder)
channelBuilder - the channel builderDefaultChannelBuilderTransport getRemotingTransport()
Transportvoid setRemotingTransport(Transport remotingTransport)
remotingTransport - transportTransportvoid setMessagingTransport(Transport messagingTransport)
messagingTransport - transportvoid setMessagingTransport(java.lang.String channelType,
Transport messagingTransport)
channelType - channel typemessagingTransport - transportChannelType,
TransportTransport getMessagingTransport()
Transportjava.util.Map<java.lang.String,Transport> getMessagingTransports()
Transport getMessagingTransport(java.lang.String channelType)
channelType - channel typeChannelType,
Transportvoid setAliasRegistry(AliasRegistry aliasRegistry)
aliasRegistry - alias registryAliasRegistryvoid setScanPackageNames(java.util.Set<java.lang.String> packageNames)
packageNames - AliasRegistryvoid start()
void stop()
void stop(boolean stopTransports)
stopTransports - true to stop associated transportsRemotingChannel newRemotingChannel(java.lang.String id, java.lang.String uri)
id - identifier for this channeluri - uri of the server to connect toRemotingChannelRemotingChannel newRemotingChannel(java.lang.String id, java.lang.String uri, int maxConcurrentRequests)
id - identifier for this channeluri - uri of the server to connect tomaxConcurrentRequests - maximum number of concurrent requestsRemotingChannelMessagingChannel newMessagingChannel(java.lang.String id, java.lang.String uri)
id - identifier for this channeluri - uri of the server to connect toMessagingChannelMessagingChannel newMessagingChannel(java.lang.String channelType, java.lang.String id, java.lang.String uri)
channelType - a channel typeid - identifier for this channeluri - uri of the server to connect toChannelType,
MessagingChannelRemotingChannel newRemotingChannel(java.lang.String id, java.net.URI uri)
URIid - identifier for this channeluri - uri of the server to connect toRemotingChannelRemotingChannel newRemotingChannel(java.lang.String id, java.net.URI uri, int maxConcurrentRequests)
URIid - identifier for this channeluri - uri of the server to connect tomaxConcurrentRequests - maximum number of concurrent requestsRemotingChannelMessagingChannel newMessagingChannel(java.lang.String id, java.net.URI uri)
URIid - identifier for this channeluri - uri of the server to connect toMessagingChannelMessagingChannel newMessagingChannel(java.lang.String channelType, java.lang.String id, java.net.URI uri)
URIchannelType - a channel typeid - identifier for this channeluri - uri of the server to connect toChannelType,
MessagingChannelRemotingChannel newRemotingChannel(java.lang.String id, ServerApp serverApp)
id - identifier for this channelserverApp - server application to connect toRemotingChannel,
ServerAppRemotingChannel newRemotingChannel(java.lang.String id, ServerApp serverApp, int maxConcurrentRequests)
id - identifier for this channelserverApp - server application to connect tomaxConcurrentRequests - maximum number of concurrent requestsRemotingChannel,
ServerAppMessagingChannel newMessagingChannel(java.lang.String id, ServerApp serverApp)
id - identifier for this channelserverApp - server application to connect toMessagingChannel,
ServerAppMessagingChannel newMessagingChannel(java.lang.String channelType, java.lang.String id, ServerApp serverApp)
channelType - a channel typeid - identifier for this channelserverApp - server application to connect toChannelType,
MessagingChannel,
ServerApp