use of org.apache.activemq.security.MessageAuthorizationPolicy in project activemq-artemis by apache.
the class MessageAuthenticationTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
BrokerService answer = new BrokerService();
answer.setPersistent(false);
answer.setMessageAuthorizationPolicy(new MessageAuthorizationPolicy() {
@Override
public boolean isAllowedToConsume(ConnectionContext context, Message message) {
try {
Object value = message.getProperty("myHeader");
return "abc".equals(value);
} catch (IOException e) {
System.out.println("Caught: " + e);
e.printStackTrace();
return false;
}
}
});
answer.addConnector(bindAddress);
return answer;
}
Aggregations