Skip to content

dirigiblelabs/sample-java-listener-decorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sample-java-listener-decorator

Showing how to use @Listener to subscribe to an ActiveMQ queue in Eclipse Dirigible.

Layout

sample-java-listener-decorator/   # Dirigible project (registry path)
└── demo/
    └── listener/
        ├── OrderListener.java    # @Listener — subscribes to "java-order-queue"
        └── trigger.mjs           # JS helper that sends a test message to the queue

Usage

Drop this project into the Dirigible IDE (clone via the Git perspective and publish, or copy it to /registry/public/sample-java-listener-decorator/). The synchronizer compiles OrderListener.java and registers the queue listener. Hit /services/js/sample-java-listener-decorator/demo/listener/trigger.mjs to send a test message; the listener logs OrderListener received: … on receipt.

Listener styles

Two ways to write a Java listener — pick one per @Component class (never both), like Spring:

  • Strong interfaceOrderListener is a @Component that implements MessageHandler and supplies its own destination() (like jakarta.jms.MessageListener); no @Listener annotation.
  • Method-level annotationInvoiceListener is a @Component with an @Listener-annotated method (Spring @JmsListener style), using a constructor-injected Auditor bean.

See the Develop guide and the Java SDK.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors