use of org.apache.activemq.broker.region.policy.PolicyMap in project camel by apache.
the class QueueProducerQoSTest method configureBroker.
@Override
protected void configureBroker(BrokerService broker) throws Exception {
broker.setUseJmx(true);
broker.setPersistent(true);
broker.setDataDirectory("target/activemq-data");
broker.deleteAllMessages();
broker.setAdvisorySupport(true);
broker.addConnector(brokerUri);
// configure expiration rate
ActiveMQQueue queueName = new ActiveMQQueue(">");
PolicyEntry entry = new PolicyEntry();
entry.setDestination(queueName);
entry.setExpireMessagesPeriod(1000);
PolicyMap policyMap = new PolicyMap();
policyMap.put(queueName, entry);
broker.setDestinationPolicy(policyMap);
}
use of org.apache.activemq.broker.region.policy.PolicyMap in project ignite by apache.
the class IgniteJmsStreamerTest method beforeTest.
/**
* @throws Exception If failed.
*/
@Before
@SuppressWarnings("unchecked")
public void beforeTest() throws Exception {
grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
broker = new BrokerService();
broker.setDeleteAllMessagesOnStartup(true);
broker.setPersistent(false);
broker.setPersistenceAdapter(null);
broker.setPersistenceFactory(null);
PolicyMap plcMap = new PolicyMap();
PolicyEntry plc = new PolicyEntry();
plc.setQueuePrefetch(1);
broker.setDestinationPolicy(plcMap);
broker.getDestinationPolicy().setDefaultEntry(plc);
broker.setSchedulerSupport(false);
broker.start(true);
connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI());
}
use of org.apache.activemq.broker.region.policy.PolicyMap in project ignite by apache.
the class IgniteMqttStreamerTest method beforeTest.
/**
* @throws Exception If failed.
*/
@Before
@SuppressWarnings("unchecked")
public void beforeTest() throws Exception {
grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
// find an available local port
try (ServerSocket ss = new ServerSocket(0)) {
port = ss.getLocalPort();
}
// create the broker
broker = new BrokerService();
broker.setDeleteAllMessagesOnStartup(true);
broker.setPersistent(false);
broker.setPersistenceAdapter(null);
broker.setPersistenceFactory(null);
PolicyMap plcMap = new PolicyMap();
PolicyEntry plc = new PolicyEntry();
plc.setQueuePrefetch(1);
broker.setDestinationPolicy(plcMap);
broker.getDestinationPolicy().setDefaultEntry(plc);
broker.setSchedulerSupport(false);
// add the MQTT transport connector to the broker
broker.addConnector("mqtt://localhost:" + port);
broker.setStartAsync(false);
broker.start(true);
// create the broker URL
brokerUrl = "tcp://localhost:" + port;
// create the client and connect
client = new MqttClient(brokerUrl, UUID.randomUUID().toString(), new MemoryPersistence());
client.connect();
// create mqtt streamer
dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME);
streamer = createMqttStreamer(dataStreamer);
}
Aggregations