本文整理汇总了Java中org.hornetq.api.core.SimpleString类的典型用法代码示例。如果您正苦于以下问题:Java SimpleString类的具体用法?Java SimpleString怎么用?Java SimpleString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleString类属于org.hornetq.api.core包,在下文中一共展示了SimpleString类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.hornetq.api.core.SimpleString; //导入依赖的package包/类
/**
* creates IOFabric message queues, {@link ClientMessage} producer
* and {@link ClientSession}
*
* @throws Exception
*/
protected void initialize() throws Exception {
messageBusSession = sf.createSession(true, true, 0);
QueueQuery queueQuery = messageBusSession.queueQuery(new SimpleString(Constants.address));
if (queueQuery.isExists())
messageBusSession.deleteQueue(Constants.address);
queueQuery = messageBusSession.queueQuery(new SimpleString(Constants.commandlineAddress));
if (queueQuery.isExists())
messageBusSession.deleteQueue(Constants.commandlineAddress);
messageBusSession.createQueue(Constants.address, Constants.address, false);
messageBusSession.createQueue(Constants.commandlineAddress, Constants.commandlineAddress, false);
commandlineProducer = messageBusSession.createProducer(Constants.commandlineAddress);
commandlineConsumer = messageBusSession.createConsumer(Constants.commandlineAddress, String.format("receiver = '%s'", "iofabric.commandline.command"));
commandlineConsumer.setMessageHandler(new CommandLineHandler());
messageBusSession.start();
// Runnable countMessages = new Runnable() {
// @Override
// public void run() {
// try {
// QueueQuery queueQuery = messageBusSession.queueQuery(new SimpleString(Constants.address));
// LoggingService.logInfo(MODULE_NAME, String.valueOf(queueQuery.getMessageCount()));
// } catch (HornetQException e) {
// }
// }
// };
// ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5);
// scheduler.scheduleAtFixedRate(countMessages, 10, 10, TimeUnit.SECONDS);
}
示例2: createQueue
import org.hornetq.api.core.SimpleString; //导入依赖的package包/类
@Test
public void createQueue() throws HornetQException {
final ClientSession clientSession = hornetQMixIn.getClientSession();
final SimpleString queueName = new SimpleString("testQueue");
clientSession.createQueue(queueName, queueName);
final BindingQuery bindingQuery = clientSession.bindingQuery(queueName);
Assert.assertTrue(bindingQuery.isExists());
Assert.assertEquals(1, bindingQuery.getQueueNames().size());
final SimpleString actualQueueName = bindingQuery.getQueueNames().get(0);
Assert.assertEquals(queueName, actualQueueName);
}