Red Hat Training
A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform
18.8.6. JMS メッセージセレクター
メッセージングアプリケーションが受信するメッセージをフィルターする必要がある場合は、JMS API メッセージセレクターを使用して、メッセージコンシューマーが対象のメッセージを指定できるようになります。メッセージセレクターは、メッセージをアプリケーションではなく JMS プロバイダーにフィルタリングする作業を割り当てます。
メッセージセレクターは以下のように定義できます。
@MessageDriven(name = "MDBMessageSelectorExample", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"), @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "color = 'RED'") }) @TransactionManagement(value= TransactionManagementType.CONTAINER) @TransactionAttribute(value= TransactionAttributeType.REQUIRED) public class MDBMessageSelectorExample implements MessageListener { public void onMessage(Message message).... }