io.advantageous.qbit.queue.Queue类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中io.advantageous.qbit.queue.Queue类的一些代码示例,展示了Queue类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Queue类的具体详情如下:
包路径:io.advantageous.qbit.queue.Queue
类名称:Queue

Queue介绍

[英]Represents a queue manager. Queues are split up into receivers views and sender views to facilitate batching. created by Richard on 8/4/14.
[中]表示队列管理器。队列被分成接收者视图和发送者视图,以便于批处理。理查德于2014年8月4日创作。

代码示例

代码示例来源:origin: advantageous/qbit

/**
 * name of queue
 *
 * @return name
 */
@Override
public String name() {
  return queue.name();
}

代码示例来源:origin: advantageous/qbit

@Override
public ReceiveQueue<Response<Object>> responses() {
  return responseQueue.receiveQueue();
}

代码示例来源:origin: advantageous/qbit

@Override
public SendQueue<MethodCall<Object>> requests() {
  return requestQueue.sendQueue();
}

代码示例来源:origin: advantageous/qbit

final SendQueue<Response<Object>> webResponseSendQueue = webResponseQueue.sendQueue();
responseQueue.startListener(new ReceiveQueueListener<Response<Object>>() {

代码示例来源:origin: advantageous/qbit

private void initQueue() {
  /* Clean it up. */
  queue.ifPresent(actualQueue -> {
    try {
      actualQueue.stop();
    } catch (Exception ex) {
      logger.debug("Unable to stop queue", ex);
    }
  });
  receiveQueue.ifPresent(actualReceiveQueue -> {
    try {
      actualReceiveQueue.stop();
    } catch (Exception ex) {
      logger.debug("Unable to shut down receive queue", ex);
    }
  });
  try {
    this.queue = Optional.of(queueSupplier.get());
    this.queue.ifPresent(actualQueue -> receiveQueue = Optional.of(actualQueue.receiveQueue()));
  } catch (Exception ex) {
    logger.error("Unable to create queue with queue supplier", ex);
    this.queue = Optional.empty();
    this.receiveQueue = Optional.empty();
  }
}

代码示例来源:origin: advantageous/qbit

@Before
public void setUp() throws Exception {
  personQueue = JsonQueue.createListQueue(Person.class, QueueBuilder.queueBuilder()
      .setName("FOO").build());
  personSendQueue = personQueue.sendQueue();
  personReceiveQueue = personQueue.receiveQueue();
  personSendQueue.shouldBatch();
  personSendQueue.name();
  personSendQueue.size();
  personQueue.name();
  personQueue.size();
}

代码示例来源:origin: advantageous/qbit

final SendQueue<String> sendQueue = queue.sendQueue();
final ReceiveQueue<String> receiveQueue = queue.receiveQueue();

代码示例来源:origin: advantageous/qbit

@Override
public SendQueue<MethodCall<Object>> requestsWithAutoFlush(int flushInterval, TimeUnit timeUnit) {
  return requestQueue.sendQueueWithAutoFlush(flushInterval, timeUnit);
}

代码示例来源:origin: advantageous/qbit

public void startReturnHandlerProcessor(ReceiveQueueListener<Response<Object>> listener) {
  responseQueue.startListener(listener);
}

代码示例来源:origin: advantageous/qbit

/**
   * Stop the queue.
   */
  @Override
  public void stop() {
    queue.stop();
  }
}

代码示例来源:origin: advantageous/qbit

/**
 * started
 *
 * @return started
 */
@Override
public boolean started() {
  return queue.started();
}

代码示例来源:origin: advantageous/qbit

/**
 * size
 *
 * @return size
 */
@Override
public int size() {
  return queue.size();
}

代码示例来源:origin: advantageous/qbit

queue.startListener(new ReceiveQueueListener<String>() {
  @Override
  public void receive(String item) {
final SendQueue<String> sendQueue = queue.sendQueue();
for (int index = 0; index < 10; index++) {
  sendQueue.send("item" + index);
queue.stop();

代码示例来源:origin: advantageous/qbit

responseQueue.receiveQueue() : null;
    eventQueue.receiveQueue();
requestQueue.startListener(new ReceiveQueueListener<MethodCall<Object>>() {

代码示例来源:origin: advantageous/qbit

@Test
public void integrationTest() throws Exception {
  final Queue<String> queue = QueueBuilder.queueBuilder().build();
  final QueueToStreamUnicast<String> stream = new QueueToStreamUnicast<>(queue);
  final Iterator<String> iterator = toIteratorWithRequestsPipelineSize(stream, 10);
  final SendQueue<String> sendQueue = queue.sendQueue();
  for (int index = 0; index < 100; index++) {
    sendQueue.send("" + index);
  }
  sendQueue.flushSends();
  Thread thread = new Thread(() -> {
    Sys.sleep(500);
    queue.stop();
  });
  thread.start();
  int i = 0;
  while (iterator.hasNext()) {
    String item = iterator.next();
    assertEquals("" + i, item);
    puts("" + i, item);
    i++;
  }
  assertEquals(100, i);
}

代码示例来源:origin: advantageous/qbit

queue.startListener(item -> {
  count.decrementAndGet();
  if (count.get() == 0) {
};
sendQueue = queue.sendQueueWithAutoFlush(periodicScheduler, 100, TimeUnit.MILLISECONDS);

代码示例来源:origin: advantageous/qbit

@Test
public void basicTest() {
  sendQueue.send("hi");
  sendQueue.flushSends();
  final String item = receiveQueue.pollWait();
  assertEquals("hi", item);
  assertTrue(queue.hashCode() != 0);
  assertTrue(queue.name() != null);
  assertTrue(queue.size() == 0);
  assertTrue(queue.toString() != null);
  assertTrue(sendQueue.shouldBatch());
  assertTrue(sendQueue.size() == 0);
  assertTrue(sendQueue.name() != null);
  assertTrue(sendQueue.hashCode() != 0);
  assertTrue(receiveQueue.hashCode() != 0);
}

代码示例来源:origin: advantageous/qbit

@Before
public void setUp() throws Exception {
  personQueue = JsonQueue.createMapQueue(String.class, Person.class, QueueBuilder.queueBuilder()
      .setName("FOO").build());
  personSendQueue = personQueue.sendQueue();
  personReceiveQueue = personQueue.receiveQueue();
  personSendQueue.shouldBatch();
  personSendQueue.name();
  personSendQueue.size();
  personQueue.name();
  personQueue.size();
}

代码示例来源:origin: advantageous/qbit

@Before
public void setup() {
  final QueueBuilder queueBuilder = QueueBuilder.queueBuilder();
  queue = queueBuilder.setArrayBlockingQueue().setBatchSize(10)
      .setCheckEvery(5).setCheckIfBusy(false)
      .setName("Queue test").setPollTimeUnit(TimeUnit.MILLISECONDS)
      .setPollWait(50).build();
  receiveQueue = queue.receiveQueue();
  sendQueue = queue.sendQueue();
}

代码示例来源:origin: advantageous/qbit

@Override
public SendQueue<Event<Object>> events() {
  return this.eventQueue.sendQueueWithAutoFlush(50, TimeUnit.MILLISECONDS);
}

相关文章