Adam Bien's Weblog

Wednesday Oct 03, 2012

Project connectorZ--Lean JCA 1.6 Connector Implementations

connectorZ project is an example connector implementation under Apache 2.0 license.

The initial project (work-manager) implementation uses JCA WorkManager to execute Runnable implementations asynchronously:


@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class ThreadsResource {

    @Resource(name="jca/workmanager")
    WorkExecutorFactory executorFactory;
    
    public String threads(){
        try(WorkExecutor executor = executorFactory.newExecutor();){
        Runnable runnable = new Runnable(){
            @Override
            public void run() {
            //some work to do
            }
        };
        executor.execute(runnable);
  }
                        

The main benefit over the EJB 3.1 @Asynchronous annotation is better management and monitoring. JCA's connection pooling is configurable by application server, so throttling and monitoring comes for free.

[The connectorZ project was initiated by factoring out examples from the book "Real World Java EE Patterns--Rethinking Best Practices" book (Second Iteration), page 303 in, chapter "Generic (File) JCA"]

See you at Java EE Workhops at MUC Airport (October 22nd-24th)!


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

Thanks for sharing!

Can you give us some bootstarp for inbound jca with MDB?

Posted by slim ouertani on October 03, 2012 at 04:28 PM CEST #

Hi Adam!
Thanks for sharing this great jca 1.6 example on github. In the other hand there is no ra.xml in the compiled-bundled (mvn clean install) work-manager.rar file. Is it a bug or also a new jca 1.6 feature?
Thanks,
;-D

Posted by dejo on July 23, 2013 at 05:09 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License