package io.quarkus.it.rabbitmq;

import javax.enterprise.context.ApplicationScoped;

import org.eclipse.microprofile.reactive.messaging.Outgoing;

import io.smallrye.mutiny.Multi;

@ApplicationScoped
public class PeopleProducer {
    @Outgoing("people-out")
    public Multi<Person> generatePeople() {
        return Multi.createFrom().items(
                new Person("bob"),
                new Person("alice"),
                new Person("tom"),
                new Person("jerry"),
                new Person("anna"),
                new Person("ken"));
    }
}

package io.quarkus.it.rabbitmq;

import java.time.Duration;

import javax.enterprise.context.ApplicationScoped;

import org.eclipse.microprofile.reactive.messaging.Outgoing;

import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;

@ApplicationScoped
public class PeopleProducer {
    @Outgoing("people-out")
    public Multi<Person> generatePeople() {
        return Uni.createFrom().nullItem()
                .onItem().delayIt().by(Duration.ofSeconds(3))
                .onItem().transformToMulti(n -> Multi.createFrom()
                        .items(new Person("bob"),
                                new Person("alice"),
                                new Person("tom"),
                                new Person("jerry"),
                                new Person("anna"),
                                new Person("ken")));
    }
}

Add delay to ensure queue is created and bound.
Add delay to ensure queue is created and bound.

In RabbitMQ queues are what store messsages for processing, while exchanges are what messages are sent to. If an exchange has no bound queues, in most standard cases, any messages sent to the exchange are dropped.

The "incoming" RabbitMQ connector is what creates and binds a queue to an exchange. This fix adds a delay to the "outgoing" messages to ensure the "incoming" connector has time to create and bind the required queue to the required exchange.
