![]() ![]() ![]() ![]() ![]() ![]() |
This chapter explains how to build and run the sample socket transport provider. This sample is installed along with AquaLogic Service Bus. The sample serves as an example implementation of a custom transport provider and the sample source code is available to you.
This chapter includes these topics:
The primary purpose of the sample socket transport provider is to serve as an example transport provider implementation. This publicly available sample demonstrates the implementation and configuration details of the Transport SDK.
This section includes these topics:
The sample transport is designed to send and receive streamed data to and from a configured TCP socket in AquaLogic Service Bus. The sample transport is intended to illustrate the following Transport SDK concepts:
Figure 6-1 shows the basic architecture of the sample socket transport provider. Any client can connect to the server socket. Data is received at the server socket and passes through the pipeline. The response comes back through the outbound transport. The response is finally sent back to the inbound transport and back to the client.
Figure 6-2 illustrates the configuration properties for the transport endpoint. These properties are configured in the schema file: SocketTransport.xsd
. See Sample Location and Directory Structure for information on the location of this file. This file allows you to extend the basic set of properties defined in the common schema provided with the SDK. Refer to the SocketTransport.xsd
file for information on each of the properties.
Tip: | See also 4. Define Transport-Specific Artifacts for more information on these configuration properties. |
Also in the SocketTransport.xsd
file are the request/response header and metadata properties, as illustrated in Figure 6-3. Refer to the SocketTransport.xsd
file for more information on these properties.
The sample socket transport provider is installed with AquaLogic Service Bus and is located in the following directory:
BEA_HOME/weblogic92/samples/servicebus/sample-transport
where BEA_HOME
is the directory in which you installed AquaLogic Service Bus.
Figure 6-4 shows the directory structure for the sample socket transport provider. This section briefly describes the folders in the sample project. You can use this directory structure as a model for developing your custom transport provider.
Table 6-1 lists and briefly describes the sample-transport directories.
The following Ant build files are also located in the sample-transport
directory:
This section explains how to build and deploy the sample transport provider.
DOMAIN_HOME/bin/setDomainEnv.cmd
(setDomainEnv.sh
on a UNIX system)
To build the socket transport, do the following:
This command compiles all the source files, creates sock_transport.ear
, and puts it in the directory: BEA_HOME/weblogic92/servicebus/lib
To deploy the sample transport provider on a server, do the following:
The sample project includes a simple socket server and a client to test the server. You can use this socket server to test the socket transport provider.
This section includes the following topics:
Run the following command to start the external service, which is a server socket that listens on a specified port and receives/sends the messages.
java -classpath .\test\build\test-client.jar -Dfile-encoding=utf-8 -Drequest-encoding=utf-8 com.bea.alsb.transports.sample.test.TestServer <port> <message-file-location>
port
– The port number at which ServerSocket is listening, which is the port number in the business service.message-file-location
– (optional) The location of the message-file which will be sent as a response to the business service.file-encoding
– A system property that is the encoding of the file. (default = utf-8)request-encoding
– The encoding of the request that is sent by the socket business service. (default = utf-8)Run the following command to start the service, which is a client to a configured socket proxy-service. It sends a message and receives the response from AquaLogic Service Bus.
java -classpath .\test\build\test-client.jar -Dfile-encoding=utf-8 -Dresponse-encoding=utf-8 com.bea.alsb.transports.sample.test.TestClient <host-name> <port> <thread-ct> <message-file-location>
host-name
– The host name of the AquaLogic Service Bus server.port
– The port number at which the proxy service is listening.thread-ct
– The number of clients that can send a message to AquaLogic Service Bus.message-file-location
– (optional ) The location of the message file that will be sent as a response to the business service.file-encoding
– An optional argument specifying the encoding of the file. (default = utf-8
)response-encoding
– The encoding of the response received from the socket proxy service. (default = utf-8
)
The sample consists of a test server and a test client. The client sends a message to the server. You configure AquaLogic Service Bus to receive and process the message.
This section describes these tasks:
SocketTest
in the Enter New Project Name Field, as shown in Figure 6-5. Create a business service to talk to the server.
SocketBS
in the Service Name field. tcp://localhost:7031
, and click Add. In this section, you create a proxy service.
SocketProxy
in the Service Name field. tcp://7032
, and click Next. Now that the business and proxy services are defined, you can edit the pipeline to route incoming messages to the business service.
In this section you test the transport provider using AquaLogic Service Bus Console.
<x/>
is entered in the text area.
![]() ![]() ![]() |