Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The logical flow of the program is:

  1. The filePoller polls the inbox directory every 1000 ms looking for a file.
  2. Once a file appears in the inbox directory, the filePoller gets a thread from the workManager. The thread will be used to process the file.
  3. The filePoller creates a normalized message that contains the file to be transmitted. It sends the normalized message to the NMR. The NMR routes the message to the fileSender component.
  4. The fileSender transforms the normalized message back into a file and "sends" it (places it) to the outbox directory.
  1. myComponent subscribes to the "demo.org.servicemix.source" topic. Through its template property, myComponent uses JmsFactory to listen on
    port 61616 via ActiveMQConnectionFactory.
  2. When JMSClient is executed, it tries to make a connection to the topic demo.org.servicemix.source at port 61616
  3. It then send a text message through this connection and waits for a response.
  4. myComponent receives the message and transmit it to ProcessSVC which is probably the BPEL engine as specified in the destinationService
    property in the servicemix.xml file.
  5. When the transmission is successful myComponent send a reply to the JMSClient and "Response was @response" is printed on the console.
    Otherwise "Response time out" is printed.

Logginginformation Logging information is written to the console as files are transmitted. Typical output looks like the following:

...

Component or Bean ID

Description

filePoller myComponent

This component periodically checks the "inbox" directory looking for files. If there is a file or directory present, it adds the file to the "workingSet", which is a collection of files to be processed. The workManger is invoked to schedule the work of processing the file from the workingSet. Another thread is created and the processing of the file begins. Processing consists of marshalling the file (streaming it from disk into a normalized message). The normalized message is sent over the NMR to the fileSender component per the specified "destinationService". The destinationService is specified in the servicemix.xml file as an attribute the filePoller component. In this example, the "destinationService" is the fileSender component. Finally, after it has been processed, the filePoller deletes the file from the source directory.

fileSender

This component is the "destinationService" for the filePoller. It receives normalized messages from filePoller. The messages it receives are the files that filePoller has transferred to it via the NMR. It converts the normalized message to its original file format and sends it to the destination directory, the outbox directory. This component creates the filename to which to copy the file by concatenating the string "sample_" with the process id following by ".xml". The concatenated string is passed to the org.servicemix.expression.JaxenStringXPathExpression bean as an argument to the constructor, as can be seen by the constructor-arg value tag in the XML file.

workManager

This bean is used by the filePoller to increase the throughput of the application. The workManager is a thread pool whose size can be adjusted declaratively in the servicemix.xml file. The other components in the BPEL application ask the workManager for threads as needed. For example, threads are used by this application to periodically (every second) check for files in the inbox. Other threads are used to do the work of processing files (streaming them in, normalizing them, and sending them to the NMR). Note: The fileSender component also uses a thread to do its' work, however, it is not using a thread from the workManager's thread pool.JMS binding component subscribes to the "demo.org.servicemix.source" topic via its defaultDestinationName
property specified on the servicemix.xml configuration file. Through its template property, it uses JmsFactory to listen on port 61616 via
ActiveMQConnectionFactory. When it receives a message, it sends it to ProcessSVC as specified on destinationService property which is possibly
the BPEL engine (not sure)

Useful Code Hints

This section describes the start-up sequence and how the ServiceMix container interacts with the BPEL application. The Java class files are located in the servicemix-1.0.1.jar file in the ServiceMix installation directory. To look at the Java source code, unjar and decompile the .class files or download the source code. Please note: the downloadable source code is slightly different than the compiled binary code.

...