我是JMS和WildFly 10.0.0.CR5
的新手我从一个非常简单的任务开始:向WildFly附带的default
服务器添加一个主题,并部署一个MDB(在一个EJB jar中,并且EJB jar在一个EAR中),监听话题。 MDB的代码是:
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/topic/test"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "mdbTestSubscription")
},
mappedName = "java:/jms/topic/test")
public class MessageDrivenBeanTest implements MessageListener {
private static final Logger log = LoggerFactory.getLogger(MessageDrivenBeanTest.class);
/**
* Default constructor.
*/
public MessageDrivenBeanTest() {
log.info(String.format("Building <%s>", this.getClass()));
}
/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message) {
log.info("Message received");
}
}
另外,我停用了发货的ExampleDS
。我将不得不使用我的。
当我尝试部署EAR包时,出现以下错误:
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents: [service jboss.naming.context.java.comp."mytest-ear-0.0.1-SNAPSHOT"."mytest-jms-0.0.1-SNAPSHOT".MessageDrivenBeanTest.DefaultDataSource]
实际上我有两个问题。
首先是:如何正确配置错误中提到的DefaultDatasource
?
还有一个更普遍的问题:为什么MDB在寻找数据源时,我从未要求过这个问题?