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
69
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
43
Life of our small product
khasunuma
0
32
How to adapt MicroProfile API for generic Web applications
khasunuma
0
30
Overviewing Admin Console
khasunuma
0
29
Introduction to MicroProfile Metrics
khasunuma
0
51
Basic method for Java EE Web Profile
khasunuma
0
27
Collections Framework Begineers Guide 2
khasunuma
0
64
JLS myths ~ if-then-else statement ~
khasunuma
0
32
Introduction to Date and Time API 4
khasunuma
0
61
Other Decks in Programming
See All in Programming
Inside of Swift Export
giginet
PRO
1
520
Kotlin 2.2が切り拓く: コンテキストパラメータで書く関数型DSLと新しい依存管理のかたち
knih
0
380
ビルドプロセスをデバッグしよう!
yt8492
0
270
ノーコードからの脱出 -地獄のデスロード- / Escape from Base44
keisuke69
0
650
Tangible Code
chobishiba
3
500
Kotlin + Power-Assert 言語組み込みならではのAssertion Library採用と運用ベストプラクティス by Kazuki Matsuda/Gen-AX
kazukima
0
100
マイベストのシンプルなデータ基盤の話 - Googleスイートとのつき合い方 / mybest-simple-data-architecture-google-nized
snhryt
0
140
オンデバイスAIとXcode
ryodeveloper
0
430
GitHub Copilotを使いこなせ!/mastering_github_copilot!
kotakageyama
2
860
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.3k
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
7
6.1k
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
340
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Context Engineering - Making Every Token Count
addyosmani
8
360
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
2.9k
Producing Creativity
orderedlist
PRO
348
40k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Bash Introduction
62gerente
615
210k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Git: the NoSQL Database
bkeepers
PRO
431
66k
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