$30 off During Our Annual Pro Sale. View Details »
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
76
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
46
Life of our small product
khasunuma
0
35
How to adapt MicroProfile API for generic Web applications
khasunuma
0
32
Overviewing Admin Console
khasunuma
0
31
Introduction to MicroProfile Metrics
khasunuma
0
54
Basic method for Java EE Web Profile
khasunuma
0
30
Collections Framework Begineers Guide 2
khasunuma
0
66
JLS myths ~ if-then-else statement ~
khasunuma
0
34
Introduction to Date and Time API 4
khasunuma
0
65
Other Decks in Programming
See All in Programming
チームをチームにするEM
hitode909
0
300
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
440
生成AIを利用するだけでなく、投資できる組織へ
pospome
1
250
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
320
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
210
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
26
22k
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
150
SwiftUIで本格音ゲー実装してみた
hypebeans
0
110
20 years of Symfony, what's next?
fabpot
2
350
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
AIコーディングエージェント(Gemini)
kondai24
0
200
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Done Done
chrislema
186
16k
A designer walks into a library…
pauljervisheath
210
24k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Agile that works and the tools we love
rasmusluckow
331
21k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Bash Introduction
62gerente
615
210k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
What's in a price? How to price your products and services
michaelherold
246
12k
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