Startup error "SRMSG00019: Unable to connect an emitter with the channel"

See original GitHub issue

Describe the bug

I’m having the same issue as #15058 which is the “SRMSG00019: Unable to connect an emitter with the channel” error on startup randomly.

Expected behavior

No error and no stacktrace.

Actual behavior

On Quarkus startup:

2021-06-10 16:22:41,101 INFO  [org.qua.cor.JobRunShell] (QuarkusQuartzScheduler_Worker-1) Job io.quarkus.scheduler.Scheduler.stats-job threw a JobExecutionException: : org.quartz.JobExecutionException: java.lang.RuntimeException: Error injecting org.eclipse.microprofile.reactive.messaging.Emitter<com.example.dto.StatsMessage> com.example.service.StatsService.emitter [See nested exception: java.lang.RuntimeException: Error injecting org.eclipse.microprofile.reactive.messaging.Emitter<com.example.dto.StatsMessage> com.example.service.StatsService.emitter]
	at io.quarkus.quartz.runtime.QuartzScheduler$InvokerJob.execute(QuartzScheduler.java:384)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.lang.RuntimeException: Error injecting org.eclipse.microprofile.reactive.messaging.Emitter<com.example.dto.StatsMessage> com.example.service.StatsService.emitter
	at com.example.service.StatsService_Bean.create(StatsService_Bean.zig:310)
	at com.example.service.StatsService_Bean.create(StatsService_Bean.zig:376)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
	at io.quarkus.arc.impl.AbstractSharedContext.access$000(AbstractSharedContext.java:14)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
	at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:17)
	at com.example.service.StatsService_ClientProxy.arc$delegate(StatsService_ClientProxy.zig:67)
	at com.example.service.StatsService_ClientProxy.computeStats(StatsService_ClientProxy.zig:124)
	at com.example.service.StatsService_ScheduledInvoker_computeStats_f8dccc2d37c7825d22dfa702247d39d08afc55f5.invokeBean(StatsService_ScheduledInvoker_computeStats_f8dccc2d37c7825d22dfa702247d39d08afc55f5.zig:46)
	at io.quarkus.arc.runtime.BeanInvoker.invoke(BeanInvoker.java:20)
	at io.quarkus.quartz.runtime.QuartzScheduler$InvokerJob.execute(QuartzScheduler.java:382)
	... 2 more
Caused by: javax.enterprise.inject.spi.DefinitionException: SRMSG00019: Unable to connect an emitter with the channel `stats-out`
	at io.smallrye.reactive.messaging.extension.ChannelProducer.getEmitter(ChannelProducer.java:192)
	at io.smallrye.reactive.messaging.extension.ChannelProducer.produceEmitter(ChannelProducer.java:137)
	at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.create(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:247)
	at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.get(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:277)
	at io.smallrye.reactive.messaging.extension.ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.get(ChannelProducer_ProducerMethod_produceEmitter_86c8bb1e4975aaf33dff96bec0d2fc8fa44920ab_Bean.zig:312)
	at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:52)
	at com.example.service.StatsService_Bean.create(StatsService_Bean.zig:293)
	... 16 more

To Reproduce

Reproduction project: reproduce-17841.zip

My emitter is described like this:

@ApplicationScoped
public class StatsService {
    @Inject
    @Channel("stats-out")
    Emitter<StatsMessage> emitter;

    @Transactional
    @Scheduled(cron = "0/5 * * ? * *", identity = "stats-job")
    public void computeStats() {
        StatsMessage message = new StatsMessage();
        message.date = LocalDateTime.now();
        emitter.send(message);
    }
}

Configuration

mp.messaging.outgoing.stats-out.connector=smallrye-kafka
mp.messaging.outgoing.stats-out.topic=stats
mp.messaging.outgoing.stats-out.value.serializer=io.quarkus.kafka.client.serialization.ObjectMapperSerializer

Environment (please complete the following information):

Output of java -version : Java 11

Quarkus version or git rev : 1.13.7

Build tool : Apache Maven 3.6.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jendibcommented, Jun 16, 2021

@cescoffier adding a few seconds of delay seems to work indeed.

0reactions
mkoubacommented, Jun 22, 2021

FTR I’ve created https://github.com/quarkusio/quarkus/pull/18060 which makes it possible to declare a “skip predicate” but it’s just a declarative way of adding an if() around the scheduled business method logic. @cescoffier Is there a way to find out whether the reactive messaging is started and ready? E.g. inject some bean and invoke some isReady() method?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quarkus fails to start when using Kafka with error ... - GitHub
The output is the following: 2022-02-04 20:17:24558 ERROR [io.qua.dep.dev. ... DefinitionException: SRMSG00019: Unable to connect an emitter ...
Read more >
Failed to inject Kafka client into GrpcService Quarkus
Without going deeply into the topic, here's my solution: You can't inject Kafka Emmiter directly to grpc service, it'll throw an exception.
Read more >
Emitter - Bridging the imperative and the reactive worlds
Injecting an Emitter​​ You indicate the targeted channel, i.e., where do you send your messages: @Inject @Channel("movies") Emitter<Movie>  ...
Read more >
cloudevents-multi + quarkus-events-smallrye - Google Groups
DefinitionException: SRMSG00019: Unable to connect an emitter with the channel `kogito-processinstances-events` at io.smallrye.reactive.messaging.extension.
Read more >
Using Apache Kafka with Reactive Messaging - Quarkus
In this case, you cannot use @Output because your method has parameters. For this, you can use an Emitter . import org.eclipse.microprofile.reactive.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found