本文整理汇总了Java中org.apache.activemq.security.MessageAuthorizationPolicy类的典型用法代码示例。如果您正苦于以下问题:Java MessageAuthorizationPolicy类的具体用法?Java MessageAuthorizationPolicy怎么用?Java MessageAuthorizationPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageAuthorizationPolicy类属于org.apache.activemq.security包,在下文中一共展示了MessageAuthorizationPolicy类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBroker
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
@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;
}
示例2: startTransportConnector
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
protected TransportConnector startTransportConnector(TransportConnector connector) throws Exception {
connector.setTaskRunnerFactory(getTaskRunnerFactory());
MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy();
if (policy != null) {
connector.setMessageAuthorizationPolicy(policy);
}
if (isUseJmx()) {
connector = registerConnectorMBean(connector);
}
connector.getStatistics().setEnabled(enableStatistics);
connector.start();
return connector;
}
示例3: getMessageAuthorizationPolicy
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
public MessageAuthorizationPolicy getMessageAuthorizationPolicy() {
return messageAuthorizationPolicy;
}
示例4: setMessageAuthorizationPolicy
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy) {
this.messageAuthorizationPolicy = messageAuthorizationPolicy;
}
示例5: setMessageAuthorizationPolicy
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy) {
}
示例6: setMessageAuthorizationPolicy
import org.apache.activemq.security.MessageAuthorizationPolicy; //导入依赖的package包/类
/**
* Sets the policy used to decide if the current connection is authorized to
* consume a given message
*/
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy) {
this.messageAuthorizationPolicy = messageAuthorizationPolicy;
}