JBOSS ESB Beginner's Guide A comprehensive, practical guide to developing servicebased applications using the Open Source JBoss Enterprise Service Bus Kevin Conner Tom Cunningham Len DiMaggio Magesh Kumar B open source community experience distilled PUBLISHING BIRMINGHAM MUMBAI
downloading Prologue the need for an ESB 1 Preface 3_ What is "JBoss"? 3 JBoss is also a community 4 What is Open Source and what are its advantages? 4 What is middleware? 6 What is an SOA? What is an ESB? 8 What is JBoss ESB? 9 What capabilities does JBoss ESB have? 10 Why JBoss ESB? 11 What is JBoss ESB's relationship with SOA? 12 What resources does the JBoss ESB community provide? 12 Online forums with a difference 12 The user forum 13 The developer forum 13 Other useful documents 13 Mailing lists 14 JIRA announcements and bugs 14 Live chat 15 What are the JBoss project and product models? 15 What this book covers 15 Chapter bibliography 18 Chapter 1: Getting Started 23. Downloading JBoss ESB 23 Downloading and installing an application server 25 and installing JBoss AS 25 Choosing which JBoss ESB distribution is right for you 28
downloading deploying modifying viewing performing downloading installing opening and installing jbossesb4.10.zip 29 Reviewing the contents ofjbossesb4.10.zip 30 JBoss ESB to JBoss AS 30 Keeping things slim 33 a profile 33 Deployable Java archives 33 Testing the installation 34 testing the installation 34 Looking at logs 35 Finding the logs 35 the deployment of an application in the server.log 36 Consoles 37 examining an MBean 38 What do you do if you see an error? 39 Summary 40 Chapter 2: Deploying your Services to the ESB 41 The quickstarts 41 Anatomy of a deployment 43 Defining the providers, services, and listeners 44 Other deployment files 46 Helloworld quickstart 47 deploying the quickstart 48 Deploying a JBoss ESB archive remotely 50 accessing the admin console 50 the deployment 51 Introduction to JBDS 54 JBDS 54 JBDS 55 Running JBDS 60 setting up the ESB runtime in JBDS 63 using JBDS to run the quickstart 68 Deploying the quickstart in JBDS 70 deploying the quickstart 71 Summary 75 Chapter 3: Understanding Services 77 Preparing JBoss Developer Studio 78 the Chapter3 app 78 Examining the structure of ESB messages 80 Examining the message 80
examining examining examining printing the message structure 81 Message implementations 84 The body 84 the main payload 85 The header 89 Routing information 89 Message identity and correlation 90 Service action 91 examining the header 91 The context 93 Message validation 94 Configuring through the ConfigTree 95 Configuring properties in the jbossesb.xml file 95 Traversing the ConfigTree hierarchy 96 Accessing attributes 96 configuration properties 97 Service pipeline and service invocation 99 Lifecycle methods 99 Processing methods 101 examining exceptions 103 Dynamic methods 105 MEP (Message Exchange Pattern) and responses 106 Servicelnvoker 108 Synchronous delivery 109 Asynchronous delivery 109 exceptions 110 Composite services 112 Service Chaining 112 Service Continuations 114 Transactions 115 Security context 117 Summary 118 Chapter 4: JBoss ESB Service Actions 119 Understanding actions 119 What is an action class? 120 The action chain 121 Custom actions 123 Lifecycle actions 123 JavaBean actions 126 Custom actions using annotations 127 Lifecycle annotations 128 Processing annotations 129
let's creating opening using increasing Outofthebox (OOTB) actions how and when to use them 131 Scripting Services invoking EJBs Web services/soap running the quickstart Transformers/converters Smooks message fragment processing running the quickstart Routers 132 134 134 135 136 138 140 implementing contentbased routing *42 Notifiers 144 see how notifiers work 144 Business Process Management I45 Drools 146 BPEL processes 146 Chapter bibliography I48 Summary I48 Chapter 5: Message Delivery on the Service Bus 143 The bus 150 Preparing JBoss Developer Studio 151 File Filters 151 the Chapters app 152 Transport providers 154 using a File provider 155 InVM transport 157 Transactions with InVM transport 158 testing InVM transactions 159 InVM message optimization 162 Controlling InVM message delivery 164 lockstep delivery 165 InVM threads 168 listener threads 168 Provider configurations 170 JMS provider 171 FTP provider 171 SQL provider 172 File provider 173 Summary 374
using using looking Chapter 6: Gateways and Integrating with External Clients 175 What is a gateway and a notifier? 176 How do we compose messages? 177 Simple composer example 178 Preparing JBoss Developer Studio 179 The J MS gateway 180 the JMS gateway 180 The File gateway 182 using the File gateway 182 The HTTP gateway 184 using the HTTP gateway 185 The HTTP bus and HTTP provider 187 The Camel gateway 188 The FTP gateway 189 The UDP gateway 189 using the UDP gateway 190 The JBoss Remoting gateway 192 the JBR gateway 193 The Groovy gateway 194 The SQL gateway 195 using the SQL gateway 195 The JCA gateway 198 Summary 199 Chapter 7: How ESB Uses the Registry to Keep Track of Services 201 The registry what, how, and why? 202 UDDI the registry's specification 203 juddi JBoss ESB's default registry 205 Configuring juddi for different protocols 205 Looking at juddi's database 206 looking at the juddi registry database 208 Other supported UDDI providers 209 Custom registry solutions 209 Endpoint reference 209 at EPRs 210 JAXR introducing the Java API for XML registries 212 Federation 212 Load balancing 213 Registry maintenance and performance 213 Registry interceptors 214
querying preparing switching securing Incorporating incorporating incorporating Monitoring 214 Examining juddi query counts 215 the UDDI server 216 Chapter bibliography 220 Summary 220 Chapter 8: Integrating Web Services with ESB 221 Preparing JBoss Developer Studio 222 the Chapter8 application 222 consoles 224 Exporting ESB services as a web service 225 running the sample 226 Action implementation 228 Securing EBWS 229 the sample 230 Other security mechanisms 233 ESB web service client 234 soapul client 234 ESB SOAP client 234 Request processing 236 Response processing 238 The Wise SOAPCIient 239 the Wise SOAP Client 240 Request and response processing 241 Custom handlers 243 Colocated web services 244 SOAPProcessor 245 a SOAPProcessor client 245 Web service proxies 248 SOAPProxy 248 SOAPProxy into the application 248 Tweaking HttpClient 250 SOAPCIient 250 SOAPProxy 251 Sample properties 251 Custom configurator 252 SOAPProxy security pass through 253 Cleaning up deployments 254 SOAPProxy security pass through 255 Summary 257
Appendix A: Where to go Next with JBoss ESB? 259 Creating service definitions with the JBDS ESB editor 259 Using other UDDI providers (HP Systinet and SOA Software Service Manager) 262 Using other JBoss project technologies 263 JBoss Drools and rulesbased services 263 JBoss Riftsaw and BPEL services 268 JBoss jbpm and Business Process Management 272 Using Maven with JBoss ESB 274 Compiling with Maven 275 ESB packaging with Maven 276 How to test your ESB services 278 Testing a single action 279 AbstractTestRunner 280 TestMessageStore 282 Arquillian 283 Cargo 285 Chapter bibliography 286 Appendix B: Popquiz Answers 287 Index 289 Ivlll