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
100
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
67
Life of our small product
khasunuma
0
49
How to adapt MicroProfile API for generic Web applications
khasunuma
0
47
Overviewing Admin Console
khasunuma
0
47
Introduction to MicroProfile Metrics
khasunuma
0
74
Basic method for Java EE Web Profile
khasunuma
0
48
Collections Framework Begineers Guide 2
khasunuma
0
88
JLS myths ~ if-then-else statement ~
khasunuma
0
70
Introduction to Date and Time API 4
khasunuma
0
88
Other Decks in Programming
See All in Programming
AIエージェントで 変わるAndroid開発環境
takahirom
2
580
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
200
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
140
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
360
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
140
act1-costs.pdf
sumedhbala
0
210
どこまでゆるくて許されるのか
tk3fftk
0
480
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
200
1B+ /day規模のログを管理する技術
broadleaf
0
130
Contextとはなにか
chiroruxx
1
390
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
140
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
330
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Believing is Seeing
oripsolob
1
170
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
4 Signs Your Business is Dying
shpigford
187
22k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
410
Are puppies a ranking factor?
jonoalderson
1
3.7k
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