Open-Source ESBs in Action: Example Implementations in Mule and ServiceMix by Jos Dirksen Tijs Rademakers
Author:Jos Dirksen Tijs Rademakers [Tijs Rademakers, Jos Dirksen]
Language: eng
Format: mobi
Publisher: Manning Publications
Published: 2011-07-08T14:45:05.138000+00:00
host The location where the JNDI registry is running
port The port the JNDI registry is running on
method The method to invoke on the remote EJB
object The name under which the EJB is registered
Note that the default EJB connector in Mule doesn’t support EJB 3, but only EJB 2.1. So the Mule EJB connector will expect an EJB home interface to be available. Luckily, we can easily make our EJB 3 implementation of the person service (listing 6.36) EJB 2.1–compliant by adding a @RemoteHome annotation, which references a PersonServiceEJBHome interface. We also need to implement an EJB object interface class with PersonServiceEJB-Object. Now our person service is EJB 2.1–compliant and we can invoke the EJB with the Mule EJB connector.
Make sure the OpenEJB container is started (ext:start-openejb) and the EJB is deployed (chapter6-ejb-deploy-ejb). When you run this example with the chapter6-ejb Ant target and drop the test file, query-person.txt, into the chapter6/6-ejb/in directory, you’ll see that this method is invoked and that the Persons found are stored in the directory specified by the last endpoint. Now let’s move on to the last section of this chapter, where we implement the same example in ServiceMix.
6.6.2. EJB 3 and ServiceMix
ServiceMix doesn’t provide a standard EJB binding component or service engine. Various JBI-based EJB binding components are available that we can use instead. However, in this section we show how you can use Spring with the ServiceMix JSR181 binding component to provide EJB 3 connectivity.
With this component, it’s very easy to expose POJOs as services. To use this functionality to connect to EJBs, we use Spring’s JndiObjectFactoryBean. With this component we can expose a remote EJB 3 bean and access it as a normal POJO, so with this Spring bean we can use the JSR181 component to expose remote EJBs. You might remember the servicemix-bean component from chapter 3, which could also be used to expose POJOs to ServiceMix. The main difference is that with the servicemix-bean component, we need to implement a couple of lifecycle methods and be able to handle the JBI-specific way services are called. When we use the JSR181 binding component, we can just expose a POJO and don’t have to worry about the underlying JBI specifics.
Listing 6.40 shows how you need to configure Spring and this component so that you can access remote EJBS.
Listing 6.40. ServiceMix configuration that exposes EJBs as services to the NMR
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12569)
Hello! Python by Anthony Briggs(9914)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Dependency Injection in .NET by Mark Seemann(9337)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8296)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7063)
Microservices with Go by Alexander Shuiskov(6824)
Practical Design Patterns for Java Developers by Miroslav Wengner(6741)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6684)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Angular Projects - Third Edition by Aristeidis Bampakos(6089)
The Art of Crafting User Stories by The Art of Crafting User Stories(5615)
NetSuite for Consultants - Second Edition by Peter Ries(5555)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5357)
Kotlin in Action by Dmitry Jemerov(5062)
