Time for action – deploying the quickstart

As we discussed earlier in this chapter, a .esb archive is deployed by copying it to the target server profile's deploy/ directory. The best way to do this is to use the quickstart's "deploy" ant target with this command:

cd samples/quickstarts/helloworld
ant deploy

What just happened?

There's quite a bit of output from this command. It's worthwhile looking at some of this in detail so that you understand what's happening here, as you may want to re-use some of either the base-build.xml ant script shared by all the quickstarts, or the ant build.xml script used by this quickstart.

Some of the highlights are listed as follows:

  1. First, the programs that are used to send the ESB-aware and unaware messages, and the custom action that will write the received message to the server log are compiled:
    compile: 
    
    [mkdir] Created dir: /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/classes [javac] Compiling 3 source files to /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/classes
  2. Next, remember how we talked about the deployment.xml file being used to specify the JMS queues that the quickstart needs? One of the JBossESB's features is that it can be used with multiple JMS providers. By default, it's configured to use JBoss Messaging, but it also supports other JMS providers such as HornetQ. This XML transformation is performed to generate a deployment.xml file that is specific to the correct JMS provider for your configuration.
    transformDeploymentXml: 
    
    [xslt] Processing /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/META-INF/deployment.xml to /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/META-INF/deployment.xml.transformed 
    
    [xslt] Loading stylesheet /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/conf/deployment-xml.xsl 
    [delete] Deleting: /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/META-INF/deployment.xml
    
    [move] Moving 1 file to /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/META-INF
  3. Here is where the .esb archive is created:
    package-deployment: 
    
    [jar] Building jar: /jboss/local/book_downloads/jbossesb-4.9/samples/quickstarts/helloworld/build/Quickstart_helloworld.esb
  4. And, here is the actual deployment to the server:
    deploy-esb: 
    
    [copy] Copying 1 file to /opt/local/jboss-5.1.0.GA/server/all/deploy
  5. Finally, the quickstart is deployed:
    display-instructions: 
    
    [echo] Quickstart deployed to target JBoss ESB/App Server at ‘/opt/local/jboss-5.1.0.GA/server/all/deploy'. 
    
    [echo] 1. Check your ESB Server console to make surethe deployment was executed without errors. 
    
    [echo] 2. Run ‘ant runtest' to run the Quickstart.
    
    [echo] 3. Check your ESB Server console again.The Quickstart should have produced some output.
    
    deploy: BUILD SUCCESSFUL Total time: 2 seconds

Now, let's run it and trace through the actions that it performs.

When you run the quickstart, you have two options:

  • ant runtest: generates a JMS message and inserts it into a JMS queue. This causes a JMS gateway listener to wake up, wrap the message in an ESBMessage (thereby making the message ESB-aware), and pass the message to an ESB-aware listener. After that, a custom action prints the message to the server log.
  • ant sendesb: generates an ESB-aware message, and sends it directly to the ESB-aware listener. After that, the same custom action prints the message to the server log.

The server log shows the result, as follows:

2011-05-29 23:20:36,599 INFO [STDOUT] (pool-23-thread-1) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
2011-05-29 23:20:36,602 INFO [STDOUT] (pool-23-thread-1) Body: Hello World 
2011-05-29 23:20:36,602 INFO [STDOUT] (pool-23-thread-1) &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Note

Quickstart-specific help

While we have been reviewing one of the simpler quickstarts, some of the other quickstarts are more complicated and require a number of steps on the part of the user in order to demonstrate the functionality of the quickstart. A quickstart like simple_cbr requires that the user set up two extra terminal processes that will receive messages. Each quickstart contains a readme.txt (or in some cases a readme.html) that explains how to run that specific quickstart. Just follow along the steps of the readme, which also should explain what the purpose of the quickstart is, the functionality that is being demonstrated, and the output you may expect to see.

When you are finished running a quickstart, you can undeploy it from your current server by running the following command in the quickstart's directory:

ant undeploy

That will remove the ESB archive and any additional custom deployments that may have been installed while deploying the quickstart.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.107.90