org.apache.rocketmq.client.impl.consumer.ProcessQueue Java Examples
The following examples show how to use
org.apache.rocketmq.client.impl.consumer.ProcessQueue.
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: DefaultMQPushConsumerTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #2
Source File: DefaultMQConsumerWithTraceTest.java From rocketmq with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #3
Source File: DefaultMQPushConsumerTest.java From rocketmq with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #4
Source File: DefaultMQPushConsumerTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #5
Source File: DefaultMQPushConsumerTest.java From DDMQ with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #6
Source File: DefaultMQPushConsumerTest.java From rocketmq with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #7
Source File: DeFiBusMessageListenerConcurrentlyTest.java From DeFiBus with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #8
Source File: DeFiBusMessageListenerConcurrentlyOnceTest.java From DeFiBus with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #9
Source File: DeFiBusPushConsumer.java From DeFiBus with Apache License 2.0 | 6 votes |
public void unsubscribe(String topic, boolean isNeedSendHeartbeat) { LOG.info("remove subscription [{}] from consumer", topic); ConcurrentMap<MessageQueue, ProcessQueue> processQueueTable = this.defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getRebalanceImpl().getProcessQueueTable(); for (Map.Entry<MessageQueue, ProcessQueue> entry : processQueueTable.entrySet()) { MessageQueue messageQueue = entry.getKey(); ProcessQueue pq = entry.getValue(); if (messageQueue.getTopic().equals(topic)) { pq.setDropped(true); } } this.defaultMQPushConsumer.unsubscribe(topic); if (isStart.get()) { if (isNeedSendHeartbeat) { sendHeartBeatToBrokersWhenSubscribeChange(); } } }
Example #10
Source File: DefaultMQPushConsumerTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #11
Source File: DefaultMQPushConsumerTest.java From DDMQ with Apache License 2.0 | 6 votes |
private PullRequest createPullRequest() { PullRequest pullRequest = new PullRequest(); pullRequest.setConsumerGroup(consumerGroup); pullRequest.setNextOffset(1024); MessageQueue messageQueue = new MessageQueue(); messageQueue.setBrokerName(brokerName); messageQueue.setQueueId(0); messageQueue.setTopic(topic); pullRequest.setMessageQueue(messageQueue); ProcessQueue processQueue = new ProcessQueue(); processQueue.setLocked(true); processQueue.setLastLockTimestamp(System.currentTimeMillis()); pullRequest.setProcessQueue(processQueue); return pullRequest; }
Example #12
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #13
Source File: LocalMessageCache.java From rocketmq with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("An error occurred in update consume offset process.", e); } }
Example #14
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 #15
Source File: LocalMessageCache.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #16
Source File: LocalMessageCache.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } }
Example #17
Source File: LocalMessageCache.java From rocketmq with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #18
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 #19
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 #20
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #21
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } }
Example #22
Source File: LocalMessageCache.java From DDMQ with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } }
Example #23
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 #24
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 #25
Source File: LocalMessageCache.java From rocketmq-read with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #26
Source File: LocalMessageCache.java From rocketmq-read with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } }
Example #27
Source File: LocalMessageCache.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
void ack(final MessageQueue messageQueue, final ProcessQueue processQueue, final MessageExt messageExt) { consumedRequest.remove(messageExt.getMsgId()); long offset = processQueue.removeMessage(Collections.singletonList(messageExt)); try { rocketmqPullConsumer.updateConsumeOffset(messageQueue, offset); } catch (MQClientException e) { log.error("A error occurred in update consume offset process.", e); } }
Example #28
Source File: LocalMessageCache.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } }
Example #29
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 #30
Source File: ConsumeRequest.java From rocketmq with Apache License 2.0 | 4 votes |
public ProcessQueue getProcessQueue() { return processQueue; }