# Understanding the Message Broker Channels in Your Tutorial Application

This topic provides information about the Message Broker channels used in Part IV of the tutorial. You are not need to perform any of the steps described in this topic to complete the tutorial.

Channel files define the Message Broker channels available in a WebLogic Integration application. Channel files must be placed in a Schemas project in your application. Otherwise, they are not visible to your application components. A channel file, named Validate.channel, is provided for you in the Schemas project in your tutorial application. Validate.channel specifies two Message Broker channels: ValidateOrder and StopQuote.

This topic includes the following sections:

- Creating Channel Files in Your Application
- Understanding the Channels Specified for the Tutorial

Creating Channel Files in Your Application

1. Locate a Schemas project in the Application pane.
2. Right-click the Schemas project and choose New —> Channel File from the drop-down menu. The New File dialog box is displayed.
3. Ensure that Processes is selected in the left pane, and Channel File is selected in the right pane.
4. Enter a name for the file in the File name field.

Note: As indicated by the file extension in the New File dialog box, the Channel File is automatically appended with channel as its suffix.

5. Click Create.

Your new channel file is created and displayed in your Schemas folder on the Application tab. This file is a template file that you edit to define the Message Broker channels for your application.

6. To view the contents of the template file, go to the Application pane, then double-click the file you created in the Schemas folder. The file is displayed in the Source View.

Channel files are XML files that are valid against an XML Schema. The Schema is available at the following location in your WebLogic Platform installation:

    BEA_HOME\weblogic81\integration\lib\xmlschema\config\ChannelFile.xsd

In the preceding line, BEA_HOME represents the directory in which you installed WebLogic Platform.

Understanding the Channels Specified for the Tutorial

Click the Validate.channel file provided for you in your Schemas project. The file is displayed in the Source View. The following listing displays the channel definitions in Validate.channel:

    <?xml version="1.0"?>

    :

    <channels channelPrefix="/TutorialPrefix"
              xmlns="http://www.bea.com/wli/broker/channelfile"
    		  xmlns:et="http://www.example.org/request">

        <channel name ="Tutorial" messageType="none">

          <channel messageType="xml" name="ValidateOrder"
                      qualifiedMessageType="et:quoteRequest"/>

          <channel messageType="string" name="StopQuote"/>

        </channel>

    </channels>

Note the following characteristics of the Validate.channel file:

- channelPrefix="/TutorialPrefix"

Helps define the URI for the Message Broker channel. The channelPrefix is used to scope the use of the Message Broker channels across a domain. To ensure that you do not unintentionally send or receive messages to and from other applications in your domain, it is recommended that you create a unique channelPrefix for an application (for example, you can use the same name as your application name). However, if you want to use the Message Broker for communication among two or more applications, these applications should use the same prefix for the channels.

- xmlns="http://www.bea.com/wli/broker/channelfile"

A namespace that references the names used in the channel file Schema.

- xmlns:et="http://www.example.org/request"

A namespace that references the names used in the RequestQuote.xsd Schema, against which the messages sent from clients to the RequestQuote business process is validated.

- Two channels are defined in this file: ValidateOrder and StopQuote:

- For the ValidateOrder channel:

- name="ValidateOrder" specifies the name of the channel.

- messageType="xml" specifies the data type of the messages routed by that channel.

- qualifiedMessageType="et:quoteRequest" specifies the quoteRequest element in the Schema referenced by the following namespace: http://www.example.org/request. The et: prefix is associated with an XML Schema namespace through the following declaration, which appears in the channels element: xmlns:et="http://www.example.org/request". In other words, the qualifiedMessageType specifies that the XML is Typed XML—valid against the QuoteRequest.xsd Schema referenced by the http://www.example.org/request namespace. The QuoteRequest.xsd Schema file is located in the Schemas project in your application.

Warning: Make sure that the namespaces you reference in your channel files exist in your application. If they do not, although you do not get an error at compile time, you will get an error when you try to run your application.

- For the StopQuote channel:

- name="StopQuote" specifies the name of the channel

- messageType="string" specifies the data type of the messages routed by the StopQuote channel: java.lang.String

Related Topics

Message Broker Controls