Programmers Guide
Total Page:16
File Type:pdf, Size:1020Kb
JBossESB 4.6 Programmers Guide JBESB-PG-7/17/09 JBESB-PG-7/17/09 Legal Notices The information contained in this documentation is subject to change without notice. JBoss Inc. makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. JBoss Inc. shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. Java™ and J2EE is a U.S. trademark of Sun Microsystems, Inc. Microsoft® and Windows NT® are registered trademarks of Microsoft Corporation. Oracle® is a registered U.S. trademark and Oracle9™, Oracle9 Server™ Oracle9 Enterprise Edition™ are trademarks of Oracle Corporation. Unix is used here as a generic term covering all versions of the UNIX® operating system. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Limited. Copyright JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and individual contributors as indicated by the @authors tag. All rights reserved. See the copyright.txt in the distribution for a full listing of individual contributors. This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the GNU General Public License, v. 2.0. This program is distributed in the hope that it will be useful, but WITHOUT A WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License, v. 2.0 along with this distribution; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Software Version JBossESB 4.6 Restricted Rights Legend Use, duplication, or disclosure is subject to restrictions as set forth in contract subdivision (c)(1)(ii) of the Rights in Technical Data and Computer Software clause 52.227-FAR14. © Copyright 2009 JBoss Inc. Contents Table of Contents Contents................................................................ iii Message Formats........................................... 31 MessageType.JAVA_SERIALIZED...31 MessageType.JBOSS_XML................31 About This Guide.............................................. 6 Building and Using Services..............................32 What This Guide Contains.............................. 6 Listeners, Routers/Notifiers and Actions......32 Audience......................................................... 6 Listeners........................................................ 32 Prerequisites.................................................... 6 Routers.......................................................... 32 Organization.................................................... 6 Notifiers......................................................... 32 Documentation Conventions........................... 7 Actions and Messages................................... 36 Additional Documentation.............................. 7 Handling responses.......................................37 Contacting Us.................................................. 8 Error handling when processing actions.......37 Meta-data and Filters....................................38 The Enterprise Service Bus...............................10 What is a Service?......................................... 40 ServiceInvoker.............................................. 40 What is an ESB?...........................................10 Transactions.................................................. 41 When would you use JBossESB?.................10 Services and ServiceInvoker......................... 42 InVM Transport............................................42 JBossESB............................................................. 15 InVM Scope.........................................42 InVM Transacted.................................43 Transaction Semantics.........................43 Rosetta........................................................... 15 Threading.............................................44 The core of JBossESB in a nutshell..............16 Lock-step Delivery..............................44 Load Balancing....................................44 Services and Messages........................................ 18 Pass-by-Value/Pass-by-Reference.......45 Service Contract Definition..........................45 Introduction................................................... 18 Message validation..............................45 The Service.................................................... 18 Exposing an ESB service as a The Message.................................................19 webservice ........................................46 Getting and Setting Data on the Message Body........................................................... 24 Other Components.............................................49 Extensions to Body.......................................24 The Message Header..................................... 25 Introduction................................................... 49 LogicalEPR..........................................27 The Message Store........................................ 49 Default FaultTo....................................27 Data Transformation.....................................49 Default ReplyTo..................................28 Content-based Routing.................................. 49 The Message payload.................................... 28 The Registry.................................................. 50 The MessageFactory.....................................29 Example............................................................... 51 Overview....................................................... 78 Providers....................................................... 79 How to use the Message................................ 51 Services......................................................... 80 The Message structure..................................51 Transport Specific Type Implementations....83 The Service.................................................... 52 JMS Message filter configuration................. 84 Unpicking the payload..................................53 FTP configuration .......................................85 The Client...................................................... 54 FTP Listener configuration ..........................86 Configuration for a remote ServiceInvoker..54 Read-only FTP Listener................................ 86 Hints and Tips............................................... 56 Read-only FTP Listener Configuration .......87 UDP Gateway................................................ 88 Advanced Topics................................................. 57 UDP Gateway configuration......................... 88 JBoss Remoting (JBR) Configuration .........88 Introduction................................................... 57 Transitioning From The Old Configuration Fail-over and load-balancing support...........57 Model......................................................... 91 Services, EPRs, listeners and actions............57 Configuration................................................ 91 Replicated Services....................................... 58 Figure 7-2: Two service instance each on a Web Services Support........................................ 93 different node............................................59 Protocol Clustering.......................................60 JBossWS....................................................... 93 Clustering...................................................... 63 Channel Fail-over and Load Balancing........63 Out-of-the-box Actions....................................... 94 Message Redelivery...................................... 65 Scheduling of Services.................................. 66 Transformers & Converters..........................94 Simple Schedule............................................ 67 ByteArrayToString........................................ 94 Cron Schedule............................................... 67 LongToDateConverter..................................94 Scheduled Listener........................................ 68 ObjectInvoke................................................. 94 Example Configurations...............................68 ObjectToCSVString...................................... 95 Quartz Scheduler Property Configuration....69 ObjectToXStream.........................................96 XStreamToObject.........................................97 Fault-tolerance and Reliability.......................... 70 XsltAction..................................................... 98 SmooksTransformer...................................... 99 Introduction................................................... 70 SmooksAction............................................. 101 Failure classification..................................... 70 SmooksAction Configuration.....................101 JBossESB and the Fault Models...................71 Message Input Payload...............................102 Failure Detectors and Failure Suspectors.....72 XML, EDI, CSV etc Input Payloads...........102 Reliability guarantees.................................... 73 Java Input Payload......................................102 Message loss.................................................74 Specifying the Result Type........................