Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about delay queue has expired but there are no consumers #5856

Open
zhang141650 opened this issue May 10, 2024 · 0 comments
Open

about delay queue has expired but there are no consumers #5856

zhang141650 opened this issue May 10, 2024 · 0 comments
Labels

Comments

@zhang141650
Copy link

zhang141650 commented May 10, 2024

version:3.20.0

以下是消费者代码

    @PostConstruct
    public void init() {
        for (DelayQueueEnum queueEnum : DelayQueueEnum.values()) {
            MQConsumer delayQueueConsumer = SpringUtil.getBean(queueEnum.getClazz());
            if (delayQueueConsumer == null) {
                throw new ServiceException("queueName=" + queueEnum.getClazz() + ",delayQueueConsumer=null,请检查配置...");
            }
            ThreadUtil.execAsync(() -> {
                while (true) {
                    try {
                        String queueName = queueEnum.getQueName();
                        MQContextDTO contextDTO = QueueUtils.getDelayedQueueObjectTake(queueName);
                        if (ObjUtil.isNull(contextDTO) || StrUtil.equals(contextDTO.getMessageType(), "0")) {
                            continue;
                        }
                        delayQueueConsumer.listener(contextDTO);
                    } catch (Exception e) {
                        log.error(e.getMessage());
                    }
                }
            }, true);
        }
    }

现象:延时队列消息过期之后,没有监听到消息过期,直到下次发送消息的时候才能监听到过期消息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant