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
0
54
Introduction to JCA and MDB
HASUNUMA Kenji
September 30, 2017
Tweet
Share
More Decks by HASUNUMA Kenji
See All by HASUNUMA Kenji
Jakarta EE: The First Parts
khasunuma
0
35
Life of our small product
khasunuma
0
17
How to adapt MicroProfile API for generic Web applications
khasunuma
0
21
Overviewing Admin Console
khasunuma
0
19
Introduction to MicroProfile Metrics
khasunuma
0
42
Basic method for Java EE Web Profile
khasunuma
0
19
Collections Framework Begineers Guide 2
khasunuma
0
55
JLS myths ~ if-then-else statement ~
khasunuma
0
19
Introduction to Date and Time API 4
khasunuma
0
51
Other Decks in Programming
See All in Programming
為你自己學 Python
eddie
0
520
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
170
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.7k
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
2025.01.17_Sansan × DMM.swift
riofujimon
2
540
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
170
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
26
6k
Rubyでつくるパケットキャプチャツール
ydah
0
170
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
930
DMMオンラインサロンアプリのSwift化
hayatan
0
180
Featured
See All Featured
How GitHub (no longer) Works
holman
312
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Side Projects
sachag
452
42k
How to train your dragon (web standard)
notwaldorf
89
5.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Adopting Sorbet at Scale
ufuk
74
9.2k
Building Adaptive Systems
keathley
38
2.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
A designer walks into a library…
pauljervisheath
205
24k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
A Modern Web Designer's Workflow
chriscoyier
693
190k
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