Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to JCA and MDB
Search
HASUNUMA Kenji
September 30, 2017
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to JCA and MDB
HASUNUMA Kenji
September 30, 2017
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
72
Life of our small product
khasunuma
0
50
How to adapt MicroProfile API for generic Web applications
khasunuma
0
49
Overviewing Admin Console
khasunuma
0
48
Introduction to MicroProfile Metrics
khasunuma
0
78
Basic method for Java EE Web Profile
khasunuma
0
49
Collections Framework Begineers Guide 2
khasunuma
0
91
JLS myths ~ if-then-else statement ~
khasunuma
0
70
Introduction to Date and Time API 4
khasunuma
0
89
Other Decks in Programming
See All in Programming
Flow は今どうなっているか
mizdra
PRO
0
760
ソフトウェアラスタライザ
fadis
1
720
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
560
「人を評価する AI」の設計と実装
ryoyanara
0
260
Hono + Inertia + React で LP を構築した話
oukayuka
2
180
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
170
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
560
高専キャリア LT 発表内容
crysta1221
4
4.2k
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
170
Introducing Stack Pull Request in GitHub
kkamegawa
0
110
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
180
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
550
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
400
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
630
The SEO identity crisis: Don't let AI make you average
varn
0
540
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Utilizing Notion as your number one productivity tool
mfonobong
4
560
Testing 201, or: Great Expectations
jmmastey
46
8.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
670
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
560
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Crafting Experiences
bethany
1
270
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Transcript
Introduction to JCA and MDB HASUNUMA Kenji GlassFish Users
Group Japan
[email protected]
Twitter: @khasunuma
What's JCA? • JCA (Java Connector Architecture) brings integration between
systems • JCA is also base of Java EE servers • Almost Java EE developer have been used JCA
JCA Overview External System (e.g. EIS) Java EE Resource
Adapter (.rar) Web app. (.war) Outbound Inbound Java Connector Architecture (JCA)
Contracts (1/2) since JCA 1.0 (J2EE 1.3) • Connection management
(Connection pooling) • Transaction management (w/JTA) • Security management (w/JAAS)
Contracts (2/2) since JCA 1.5 (J2EE 1.4) • Life cycle
management • Work management • Transaction inflow management • Message inflow management
Application Architecture ConnectionFactory EJB Connection External System getConnection JNDI lookup
Outbound Inbound I/F
Application c.f. JMS ConnectionFactory EJB Connection JMS broker getConnection JNDI
lookup Outbound Inbound JMS
Application c.f. JDBC DataSource EJB Connection RDBMS getConnection JNDI lookup
SQL JDBC
Programming w/JCA • Many cases, JCA resource adapter is provided
by each systems • Recently JCA is mainly used to manage message inflow • In JCA 1.7 (Java EE 7/8), properties are set by annotations
Outbound @ConnectionFactoryDefinition( name = "java:comp/env/OutboundConnectionFactory", interfacename = com.example.jca.OutboundConnectionFactory, resourceAdapter =
"some-rar", ... ) @Stateless public class ExampleMessageSender { @Resource(lookup = "java.comp/env/OutboundConnectionFactory") OutboundConnectionFactory factory; public void send(...) { try (OutboundConnection conn = factory.createConnection()) { ... } catch (Exception e) { ... } } }
Attention • Session Bean SHOULD NOT be used to listen
messages • SHOULD use Message Driven Bean (MDB) to listen messages
What's MDB? • EJB specified for listening messages • Have
a callback method and handle inbound messages provided by JCA • MDB adapts both async and sync communication
Inbound @MessageDriven( activationConfig = { @ActivationConfigProperty(propertyName = ..., propertyValue =
...), ... } ) public class ExampleMessageListener implements MessageListener { public void onMessage(Message message) { ... } } Callback method invoked by the Resource Adapter
Use case: Payara Micro • Payara Micro connects other systems
on cloud via JCA adapters; • Apache Kafka • MQTT (Mosquitto, etc.) • Amazon SQS • Microsoft Azure Service Bus
Why MQ? • System/service requirements are different each other •
Now various systems/services are integrated on cloud platforms • MQ (i.g. Async) often resolves impedance matching between each systems/services
JCA is ... • JCA (Java Connector Architecture) brings integration
between systems • JCA is also base of Java EE servers, e.g. JMS, JDBC • Almost Java EE developer have been used JCA as JDBC data source
Introduction to JCA and MDB HASUNUMA Kenji GlassFish Users Group
Japan
[email protected]
Twitter: @khasunuma