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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
HASUNUMA Kenji
September 30, 2017
Programming
0
82
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
51
Life of our small product
khasunuma
0
36
How to adapt MicroProfile API for generic Web applications
khasunuma
0
35
Overviewing Admin Console
khasunuma
0
34
Introduction to MicroProfile Metrics
khasunuma
0
57
Basic method for Java EE Web Profile
khasunuma
0
32
Collections Framework Begineers Guide 2
khasunuma
0
73
JLS myths ~ if-then-else statement ~
khasunuma
0
38
Introduction to Date and Time API 4
khasunuma
0
68
Other Decks in Programming
See All in Programming
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
460
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
260
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
430
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
100
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
140
CSC307 Lecture 05
javiergs
PRO
0
490
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
410
Package Management Learnings from Homebrew
mikemcquaid
0
130
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
860
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
670
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
270
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Code Reviewing Like a Champion
maltzj
527
40k
Docker and Python
trallard
47
3.7k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
120
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
My Coaching Mixtape
mlcsv
0
43
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
52
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
370
Navigating Team Friction
lara
192
16k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
60
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