当前位置: 首页>>代码示例>>Java>>正文


Java SimpleString类代码示例

本文整理汇总了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);
	}
 
开发者ID:iotracks,项目名称:iofabric,代码行数:37,代码来源:MessageBusServer.java

示例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);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:HornetQMixInTest.java


注:本文中的org.hornetq.api.core.SimpleString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。