io.openmessaging.rocketmq.domain.ConsumeRequest Java Examples
The following examples show how to use
io.openmessaging.rocketmq.domain.ConsumeRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #2
Source File: PullConsumerImpl.java From rocketmq with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback(final String targetQueueName) { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("An error occurred in pull message process.", e); } } }); }
Example #3
Source File: LocalMessageCache.java From rocketmq with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("An error occurred in update consume offset process.", e); } } }
Example #4
Source File: LocalMessageCache.java From rocketmq with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #5
Source File: PullConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback() { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("A error occurred in pull message process.", e); } } }); }
Example #6
Source File: LocalMessageCache.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } } }
Example #7
Source File: LocalMessageCache.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #8
Source File: PullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback() { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("A error occurred in pull message process.", e); } } }); }
Example #9
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } } }
Example #10
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #11
Source File: PullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback(final String targetQueueName) { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("A error occurred in pull message process.", e); } } }); }
Example #12
Source File: LocalMessageCache.java From rocketmq-read with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } } }
Example #13
Source File: LocalMessageCache.java From rocketmq-read with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #14
Source File: PullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback(final String targetQueueName) { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("A error occurred in pull message process.", e); } } }); }
Example #15
Source File: LocalMessageCache.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } } }
Example #16
Source File: LocalMessageCache.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private MessageExt poll(long timeout) { try { ConsumeRequest consumeRequest = consumeRequestCache.poll(timeout, TimeUnit.MILLISECONDS); if (consumeRequest != null) { MessageExt messageExt = consumeRequest.getMessageExt(); consumeRequest.setStartConsumeTimeMillis(System.currentTimeMillis()); MessageAccessor.setConsumeStartTimeStamp(messageExt, String.valueOf(consumeRequest.getStartConsumeTimeMillis())); consumedRequest.put(messageExt.getMsgId(), consumeRequest); return messageExt; } } catch (InterruptedException ignore) { } return null; }
Example #17
Source File: PullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private void registerPullTaskCallback() { this.pullConsumerScheduleService.registerPullTaskCallback(targetQueueName, new PullTaskCallback() { @Override public void doPullTask(final MessageQueue mq, final PullTaskContext context) { MQPullConsumer consumer = context.getPullConsumer(); try { long offset = localMessageCache.nextPullOffset(mq); PullResult pullResult = consumer.pull(mq, "*", offset, localMessageCache.nextPullBatchNums()); ProcessQueue pq = rocketmqPullConsumer.getDefaultMQPullConsumerImpl().getRebalanceImpl() .getProcessQueueTable().get(mq); switch (pullResult.getPullStatus()) { case FOUND: if (pq != null) { pq.putMessage(pullResult.getMsgFoundList()); for (final MessageExt messageExt : pullResult.getMsgFoundList()) { localMessageCache.submitConsumeRequest(new ConsumeRequest(messageExt, mq, pq)); } } break; default: break; } localMessageCache.updatePullOffset(mq, pullResult.getNextBeginOffset()); } catch (Exception e) { log.error("A error occurred in pull message process.", e); } } }); }
Example #18
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
void ack(final String messageId) { ConsumeRequest consumeRequest = consumedRequest.remove(messageId); if (consumeRequest != null) { long offset = consumeRequest.getProcessQueue().removeMessage(Collections.singletonList(consumeRequest.getMessageExt())); try { rocketmqPullConsumer.updateConsumeOffset(consumeRequest.getMessageQueue(), offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } } }
Example #19
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }
Example #20
Source File: LocalMessageCache.java From rocketmq-read with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }
Example #21
Source File: LocalMessageCache.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }
Example #22
Source File: LocalMessageCache.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }
Example #23
Source File: LocalMessageCache.java From rocketmq with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }
Example #24
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 4 votes |
void submitConsumeRequest(ConsumeRequest consumeRequest) { try { consumeRequestCache.put(consumeRequest); } catch (InterruptedException ignore) { } }