安全的 JMS 队列连接 jboss
Secured JMS queue connection jboss
我可以使用以下方法创建安全的 JMS 队列(JBoss 服务器)连接:
Connection connection = factory.createConnection(user, pw);
有没有办法在使用以下内容时做同样的事情:
public class Sender{
@Inject
private JMSContext context;
@Resource(mappedName="java:global/jms/exampleQueue")
private Queue queue;
public void put(String message) {
context.createProducer().send(queue, message);
}
}
谢谢!
您可以使用JMSPasswordCredential
annotation。例如:
@Inject
@JMSPasswordCredential(userName="guest",password="guest")
private JMSContext context;
我可以使用以下方法创建安全的 JMS 队列(JBoss 服务器)连接:
Connection connection = factory.createConnection(user, pw);
有没有办法在使用以下内容时做同样的事情:
public class Sender{
@Inject
private JMSContext context;
@Resource(mappedName="java:global/jms/exampleQueue")
private Queue queue;
public void put(String message) {
context.createProducer().send(queue, message);
}
}
谢谢!
您可以使用JMSPasswordCredential
annotation。例如:
@Inject
@JMSPasswordCredential(userName="guest",password="guest")
private JMSContext context;