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

persist hibernate panache in incoming method mqtt isn't inserted. #1280

Open
HaHust opened this issue May 25, 2023 · 1 comment
Open

persist hibernate panache in incoming method mqtt isn't inserted. #1280

HaHust opened this issue May 25, 2023 · 1 comment

Comments

@HaHust
Copy link

HaHust commented May 25, 2023

    @Incoming("channel-topic")
    public CompletionStage<Void> readMessage(Message<byte[]> message) {
        String s = new String(message.getPayload());
        
        Pack pack = new Pack();
        pack.setPackId(s);
        Panache.withTransaction(()->packRepository.persist(pack))
            .call(()->Uni.createFrom().item(pack))
            .subscribe().with(panacheEntityBase -> log.info("Persisted "));

        String topic = "topc2";
        mqttSensorProducer.sendMessageByTopic(topic, "content topic 2");
        return message.ack();
    }

I read the message from mqtt and based on that information to add a pack record to the database and continue sending the event to another topic. However the record is not inserted. Can someone explain where I am wrong?

@cescoffier
Copy link
Member

The MQTT connector does not use duplicated context (yet).
Can you open an issue on SmallRye Reactive Messaging?

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

No branches or pull requests

2 participants