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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
HASUNUMA Kenji
September 30, 2017
Programming
0
90
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
53
Life of our small product
khasunuma
0
39
How to adapt MicroProfile API for generic Web applications
khasunuma
0
40
Overviewing Admin Console
khasunuma
0
39
Introduction to MicroProfile Metrics
khasunuma
0
61
Basic method for Java EE Web Profile
khasunuma
0
38
Collections Framework Begineers Guide 2
khasunuma
0
79
JLS myths ~ if-then-else statement ~
khasunuma
0
44
Introduction to Date and Time API 4
khasunuma
0
74
Other Decks in Programming
See All in Programming
Claude Codeログ基盤の構築
giginet
PRO
7
3.3k
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
180
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
440
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
250
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
140
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
200
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
950
Docコメントで始める簡単ガードレール
keisukeikeda
1
120
How to stabilize UI tests using XCTest
akkeylab
0
130
Featured
See All Featured
The Curse of the Amulet
leimatthew05
1
10k
A Soul's Torment
seathinner
5
2.5k
Are puppies a ranking factor?
jonoalderson
1
3.1k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
110
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Accessibility Awareness
sabderemane
0
81
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
76
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
260
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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