How can I configure dependency on JMS service?

Solution Unverified - Updated -

Issue

  • How can I configure dependency on JMS service?
    I have this class:

@Singleton
@Startup
public class ApplicationStartup {

and this method:
@PreDestroy
public void stopService() {
System.out.println("*******Service has been stopped *******");
}

When I add this to the class:
@Resource(mappedName = "queue/xyz")
private static Queue queue;

the method "stopService() " is not called when server stops.

Strange. When I remove this ( private static Queue queue;
) then this method is called again.

Can you suggest why?

Environment

  • Red Hat JBoss Enterprise Application (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content