Using Message Brokers

 <  Day Day Up  >  

Using Message Brokers

Message brokers are used for asynchronous processes. The following sections explain the technology and describe how you could use message brokers in a JPD.

Message Broker Concepts

Messaging systems are often used in enterprise applications for asynchronous communications between two software components . A message broker provides a publish-subscribe message communication model for communication within WebLogic Integration. A message broker can exist only within one server instance and cannot cross server boundaries. For processing messages across servers, you must use JMS.

Messages are published to and subscribed from channels within the message broker and include a powerful built-in filtering mechanism that uses XQuery. Channels are similar to topics in JMS. Business processes can subscribe and publish to specific channels. A business process can be started based on a subscription to a message channel, as explained earlier.

Channels within a message broker are not hierarchical. Messages can be delivered to a message broker by using the MB Publish control, which is a built-in integration control. Messages can be received from a channel by using the subscription option in the Start node or the MB Subscribe control. Messages can be published to a channel from a JPD, JPF, J2CA adapter, or portal application.

Messages published to a channel are stored in persistent storage to guarantee message delivery. If a message is published to a channel that has no subscribers configured, the message is sent to a dead-letter channel. An administrator can use this channel for reporting or debugging purposes.

Event Generators

WebLogic Integration also provides event generators used to publish messages to a message channel. Four types of event generators are supported:

  • JMS event generator ” Publish messages to a message channel from JMS queues or topics by polling for them. Channel rules can be defined to filter out which messages should be published.

  • File event generator ” Polls for files in file systems on a local directory or an FTP server and publishes the file to a channel. Channel rules can be defined to specify a file pattern.

  • Email event generator ” Used to publish messages from e-mail accounts to message broker channels. You can specify criteria for which messages should be published when defining channel rules.

  • Timer event generator ” Used to create events at specific times and publish specific messages to channels. The message content can be specified when defining the channel rules.

To create event generators in WebLogic Integration Administration Console, click the Event Generators item on the left in the main page (see Figure 11.15), and then click the type of event generator you want to create.

Figure 11.15. Creating event generators.

graphics/11fig15.jpg

To create a File event generator, click the Create New link on the left (see Figure 11.16). Specify a name and click Submit. Then click the Define a New Channel Rule link.

Figure 11.16. Creating a File event generator.

graphics/11fig16.jpg

Specify the required parameters, such as file type, channel name, and so on. Don't forget to specify one important parameter: Polling Interval, which defines how often to poll the specified directory. Also, note that you can specify days as the polling interval, which enables you to use a time period longer than one day.

Channel Files

To create a channel file, first create a Schema project. You can define multiple channels in a single channel file. A channel file can carry five payload types:

  • Untyped XML ” XML data of any type. The subscriber receives an instance of XmlObject and determines the message type at runtime.

  • Typed XML ” Can carry one type of XML document. The subscriber receives an instance of the XmlBean class at runtime, so the subscriber isn't required to determine the message type at runtime.

  • Raw data ” Non-XML data. The subscriber needs to determine some mechanism to process the message.

  • Strings ” Non-XML text. File and Email generators use this type of payload.

  • No data ” A channel file with this payload cannot carry any message. Much like a directory, it's used merely for organizing messages.

Listing 11.1 is an example of the Room Service channel file.

Listing 11.1. The Room Service Channel File
 <?xml version="1.0"?> <mb:channels channelPrefix="/RS"   xmlns:mb="http://www.bea.com/wli/broker/channelfile">         <mb:channel messageType="xml"             name="OrderDelivery"             qualifiedMessageType="et:OrderDelivery"             xmlns:et="rsDocs"/> </mb:channels> 

After creating channels, you can monitor them through the WebLogic Integration Administration Console by clicking the Message Broker link. Click the channel you want to monitor to get more information, as shown in Figure 11.17.

Figure 11.17. Monitoring channels.

graphics/11fig17.jpg

 <  Day Day Up  >  


BEA WebLogic Workshop 8.1 Kick Start
BEA WebLogic Workshop 8.1 Kick Start: Simplifying Java Web Applications and J2EE
ISBN: 0672326221
EAN: 2147483647
Year: 2004
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net