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
92
0
Share
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
57
Life of our small product
khasunuma
0
46
How to adapt MicroProfile API for generic Web applications
khasunuma
0
43
Overviewing Admin Console
khasunuma
0
42
Introduction to MicroProfile Metrics
khasunuma
0
65
Basic method for Java EE Web Profile
khasunuma
0
40
Collections Framework Begineers Guide 2
khasunuma
0
81
JLS myths ~ if-then-else statement ~
khasunuma
0
52
Introduction to Date and Time API 4
khasunuma
0
77
Other Decks in Programming
See All in Programming
煩雑なSkills管理をSoC(関心の分離)により解決する――関心を分離し、プロンプトを部品として育てるためのOSSを作った話 / Solving Complex Skills Management Through SoC (Separation of Concerns)
nrslib
4
970
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
140
JOAI2026 1st solution - heron0519 -
heron0519
0
140
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
280
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
140
実践CRDT
tamadeveloper
0
580
第3木曜LT会 #28
tinykitten
PRO
0
110
ハンズオンで学ぶクラウドネイティブ
tatsukiminami
0
130
AI-DLC Deep Dive
yuukiyo
9
4.4k
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
2
540
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
1k
iOS機能開発のAI環境と起きた変化
ryunakayama
0
190
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
170
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Utilizing Notion as your number one productivity tool
mfonobong
4
290
Fireside Chat
paigeccino
42
3.9k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
130
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
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