Class NtfyClientProducer

java.lang.Object
io.github.pimak.ntfy.quarkus.runtime.NtfyClientProducer

@Singleton public class NtfyClientProducer extends Object
Exposes a generic, application-scoped NtfyClient for CDI injection, so Quarkus apps can @Inject NtfyClient to send arbitrary notifications independent of the log-alert path.

The client is produced even for an inactive config: NtfyClient.notify(java.lang.String, java.lang.String) never throws and simply returns a failure PublishResult when the endpoint is unset, which is friendlier than failing bean resolution at startup for applications that only use the log-handler feature.

  • Constructor Details

    • NtfyClientProducer

      public NtfyClientProducer()
  • Method Details

    • ntfyClient

      @Produces @ApplicationScoped public NtfyClient ntfyClient(NtfyRuntimeConfig config)
      Produces the singleton NtfyClient built from the run-time ntfy config.
    • closeNtfyClient

      public void closeNtfyClient(@Disposes NtfyClient client)
      Releases the client's underlying HTTP resources when the application shuts down.