|
Oracle | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PubSubServer
The PubSubServer class is the most important class of pub/sub server. It's responsible for managing channel, dispatching bayeux messages, configuring server according to deployment descriptor
FactoryFinder
Method Summary | |
---|---|
void |
deleteChannel(Client client,
String url)
Delete the given url Channel and all its children and descents. |
Channel |
findChannel(String url)
Lookup a given url Channel from PubSubServer. |
Channel |
findOrCreateChannel(Client client,
String url)
Lookup a given url Channel from PubSubServer. |
ClientManager |
getClientManager()
Get ClientManager for Client |
MessageFactory |
getMessageFactory()
Get MessageFactory for creating messages. |
String |
getName()
Get the name of the server. |
void |
publishToChannel(LocalClient client,
String channel,
String payLoad)
The method is a facade method which is used for publishing messages from server side. |
void |
subscribeToChannel(LocalClient client,
String channel)
The method is a facade method which is used to subscribe a Channel on server side. |
void |
unsubscribeToChannel(LocalClient client,
String channel)
This method is a facade method which is used to unsubscribe a Channel on server side. |
Method Detail |
---|
String getName()
Get the name of the server. The name of the server can be configured in pubsub server deployment descriptor file WEB-INF/weblogic-pubsub.xml.
<server-config> <name>myserver</name> </server-config>
If the name of the server is not configured in descriptor file, then the name of the pubsub server will be the servlet context path of current web application and the leading and ending '/' characters will be striped
Channel findChannel(String url)
url
- name for the channel
Channel findOrCreateChannel(Client client, String url) throws PubSubSecurityException
Lookup a given url Channel from PubSubServer. If not found, this method will create and return the Channel. All non-exist Channels in the channel url will be created implicitly.
When creating the Channel, this method will verify client's permission to check whether the client has permission to create the Channel.
client
- client which is to create the Channel.url
- name for the channel
PubSubSecurityException
- if client has no permission to create the
given url Channel.void deleteChannel(Client client, String url) throws PubSubSecurityException
client
- client which is to delete the Channelurl
- name of the channel
PubSubSecurityException
- if client has no permission to delete the
given url Channelvoid publishToChannel(LocalClient client, String channel, String payLoad) throws PubSubSecurityException
The method is a facade method which is used for publishing messages from server side. For example, to publish "message body" to Channel "/foo/bar", this method can be called like this:
PubSubServer server = FactoryFinder.getFactory(FactoryFinder.PUBSUBSERVER_FACTORY); LocalClient client = server.getClientManager().createLocalClient(); server.publishToChannel(client, "/foo/bar", "message body");The above is equal to the following:
PubSubServer server = FactoryFinder.getFactory(FactoryFinder.PUBSUBSERVER_FACTORY); LocalClient client = server.getClientManager().createLocalClient(); Channel channel = server.findOrCreateChannel(client, "/foo/bar"); EventMessage message = server.getMessageFactory().createEventMessage(client, "/foo/bar", "message body"); channel.publish(message, ChannelPattern.ITSELF);
client
- LocalClient object.channel
- Channel pattern.payLoad
- String will be used to fill in "data" field of bayuex event message
PubSubSecurityException
- If any security error occurs.void subscribeToChannel(LocalClient client, String channel) throws PubSubSecurityException
The method is a facade method which is used to subscribe a Channel on server side. Message sent to the channel will be wrapped into a DeliveredMessageEvent object and passed to the listeners registered to the LocalClient. For example, to subscribe Channel "/foo/bar", this method can be called like this:
PubSubServer server = FactoryFinder.getFactory(FactoryFinder.PUBSUBSERVER_FACTORY); LocalClient client = server.getClientManager().createLocalClient(); client.registerMessageListener(new MyDeliveredMessageListener()); server.subscribeToChannel(client, "/foo/bar");The above is equal to the following:
PubSubServer server = FactoryFinder.getFactory(FactoryFinder.PUBSUBSERVER_FACTORY); LocalClient client = server.getClientManager().createLocalClient(); client.registerMessageListener(new MyDeliveredMessageListener()); Channel channel = server.findOrCreateChannel(client, "/foo/bar"); channel.subscribe(client, Channel.ChannelPattern.getPattern("/foo/bar"));
client
- LocalClient object.channel
- Channel url
PubSubSecurityException
- If any security error occurs.void unsubscribeToChannel(LocalClient client, String channel)
This method is a facade method which is used to unsubscribe a Channel on server side. This method is equal to the following:
Channel channel = server.findChannel("/foo/bar"); channel.unsubscribe(myLocalClient, Channel.ChannelPattern.getPattern("/foo/bar"));
client
- LocalClient objectchannel
- Channel urlClientManager getClientManager()
MessageFactory getMessageFactory()
|
Documentation is available at http://download.oracle.com/docs/cd/E12839_01/web.1111 Copyright 1996,2009, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Part Number E13941-01 Oracle WebLogic Server 10.3.1 API Reference |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |