Channels Message Delivery and Order of Delivery Guarantee

Using the HTTP Publish-Subscribe Server 12-3 The pub-sub server can run in a clustered environment by using JMS to make the messages shareable between nodes of the cluster. In this case, the pub-sub server essentially delegates message handling to a JMS provider. You can also specify that messages be persisted to physical storage such as a file system or database. By default messages are not persisted. The following sections provide additional information about the pub-sub server: ■ Section 12.1.2, Channels ■ Section 12.1.3, Message Delivery and Order of Delivery Guarantee

12.1.2 Channels

Channels are named destinations to which clients subscribe and publish messages. Programmers define initial channels, channel mapping, and security by creating the weblogic-pubsub.xml deployment descriptor file and packaging it in the WEB-INF directory of the Web application, alongside the standard web.xml and weblogic.xml files. Programmers can optionally use the pub-sub server APIs in servlets to further find, create, and destroy channels dynamically. It is up to the programmer to decide whether clients can create and destroy channels. This means that the programmer, if required, will have to constrain the use of the create and destroy methods based on client authorization. Any attempt by an unauthorized client to create or destroy a channel generates an error message. When the pub-sub server destroys an existing channel, all the clients subscribed to that channel and sub-channels of that channel are automatically unsubscribed. Unsubscribed clients receive a disconnect response message from the pub-sub server when it destroys the channel so that clients can try to reconnect and resubscribe to the other channels. The channel namespace is hierarchical. This means that a set of channels can be specified for subscriptions by a channel gobbling pattern with wildcards like and . The client is automatically registered with any channels that are created after the client subscribed with a wildcard pattern.

12.1.3 Message Delivery and Order of Delivery Guarantee

The order of delivery of messages is not guaranteed between the client and the pub-sub server. This means that if the pub-sub server publishes message1 and then message2, the client may receive the messages in that order, or it may also receive them in reverse order. On the Web, clients are by definition loosely connected and it is possible that a subscriber is inactive or not connected when the pub-sub server publishes a message. The following rules govern the behavior of message delivery in this case: ■ Messages published by the pub-sub server when a client is unreachable are not delivered to the client. ■ When the clients reconnects back, it will continue to receive newly published messages. ■ In order to recover already-published messages, the pub-sub server must be configured for persistent messages and the channel be configured as a persistent channel.0 12-4 Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server

12.2 Examples of Using the HTTP Publish-Subscribe Server