Before we take an in-depth look at one quickstart, it's important to understand the deployment requirements for any JBoss ESB service-based application. When we discussed the types of archives that are deployable to the JBoss AS servers in the first chapter, we briefly talked how in addition to WAR files (.war
), EAR files (.ear
), and SAR files (.sar
), JBoss ESB added the .esb
archive. Let's now take a look at just what has to be in a .esb
archive, in order for it to be deployed.
Note that the quickstarts all create complete and deployable .esb
archives. The base-build.xml
file includes the definition of the "deploy" task and this creates the deployable .esb
archives.
If you look inside a JBoss ESB .esb
archive, you'll see a similar directory tree of files and directories:
The most important part of the configuration file for an .esb
archive is jboss-esb.xml
. Depending upon the complexity of your application, jboss-esb.xml
can be an intimidating file to edit, but if you keep in mind that despite the complexity of any application, the goals of this file are to define the application's providers, listeners, and services.
We've discussed services already in this book, but who are these providers? And, what do they provide?
Providers are servers or packages that exist outside of JBoss ESB that—for the lack of a better word—"provide" resources to the services defined in the .esb
archive. You define the endpoints through which the services access these resources in jboss-esb.xml
. Some examples of the types of resources that providers make available are JMS topics and queues, FTP servers, or SQL access to a database.
Let's take a high-level look at what a jboss-esb.xml
file looks like. We'll take a much more in depth look at a specific quickstart's jboss-esb.xml
, and other configuration files, in the next section of this chapter. For now, we'll ease into the water and save the detailed XML for a later chapter. The following image describes the connection of the services contained within the jboss-esb.xml
file:
The file is divided into two main sections: Providers and Services.
Each provider definition includes:
jboss-esb.xml
file. This ID is used to reference the endpoint that the provider defines, and is used instead of the provider name, to reference that endpoint.cron
settings.Each service definition includes:
What does it mean to be "ESB-aware?"
It refers to being able to handle messages in the format used by the ESB as opposed to any message format such as JMS or HTTP. The providers that you define work in pairs. The ESB-unaware provider helps you to bring messages "onboard" onto the ESB, and the ESB-aware provider handles messages once they are on the ESB. The ESB-unaware providers work with processes that we refer to as "gateways" to "onboard" messages onto the ESB. We'll discuss this in detail in Chapter 5 and Chapter 6 when we look at message delivery and gateways.
is-gateway="true"
.busid
of the provider on which it relies.In addition to jboss-esb.xml
, some quickstarts include other deployment-related files, for example, deployment.xml
.
When an .esb
archive is deployed, the sequence of actions is that message queues are deployed first, then ESB-aware services, and finally the gateways. This sequence is important so the application services are always running before any clients can push data to them. After this, the registry is updated, so that clients and other services can find the deployed services (http://community.jboss.org/wiki/JBossESBDeploymentStrategies). This requirement is specified by the deployment.xml
file. This file defines the exact order in which the message queues are deployed. In addition, you can use this file to make your .esb
deployment dependent on other deployments. In this way you can be sure that your .esb
will have all the resources that it needs to run when it is deployed.
Depending on the types of resources that your .esb
requires, there may be additional configuration files. One type of file that you'll see with many of the quickstarts is used to define the service dependencies needed by JMS queues. These files are named jbm-queue-service.xml
(where "jbm" stands for JBoss Messaging).
Let's stop looking at quickstarts in the abstract and examine a quickstart in detail. The tasks that the quickstart performs are very simple, but every configuration and operational characteristic of the quickstart is used and expanded upon by the other quickstarts or custom applications that you build. The quickstart that we'll look at is the ESB version of the classic programming example; helloworld.
In this section, we'll walk through running a quickstart. This will give you hands on experience in deploying, running, reviewing the operations that the quickstart performs, and then undeploying an .esb
archive.
In keeping with programming tradition, the simplest of the quickstarts is "helloworld". It's a small program, but there are those who love it!
Apologies to Daniel Webster
"It is, as I have said, a small college, and yet there are those who love it."
http://www.dartmouth.edu/~dwebster/speeches/dartmouth-peroration.html
What does this quickstart do? It performs one of two functions, depending on how the quickstart is invoked. It either receives a message through a JMS gateway listener and passes that message to the gateway's corresponding ESB-aware listener, or it skips the gateway and receives the message directly at an ESB-aware listener. After that, the quickstart writes the message to the server log and exits.
While, at first glance, the helloworld quickstart may appear too simple to serve as an useful example of a .esb
archive, it is a fully functioning and deployable .esb
. As it is simple, it will let us concentrate on the configuration, deployment, and execution of .esb
archives, without being distracted by examples of JBoss ESB many features or integrations.
Let's start with the deployment.