Class Messaging
java.lang.Object
com.codename1.backend.messaging.Messaging
Opens the MessageTransport a configuration names, and finds the one of
the calling thread's server.
| Setting | Default | |
|---|---|---|
cn1.messaging.url |
see below | memory:, db:, redis://..., amqp://..., kafka://..., sqs://..., pubsub://... |
cn1.messaging.lease |
60000 | milliseconds before a message a consumer took and never settled is delivered again |
cn1.messaging.timeout |
5000 | milliseconds a broker connection or reply may take |
cn1.messaging.db.poll |
500 | milliseconds between polls of an empty db: queue |
The retry settings are RetryPolicy's. Without cn1.messaging.url,
Spring Boot's spring.rabbitmq.host (or .addresses) selects AMQP and
spring.kafka.bootstrap-servers Kafka; otherwise a server with a data
source queues in its database and one without queues in memory.
A broker transport is compiled into an application only when its
configuration names it: the build registers that one transport's factory
with register(String, Messaging.TransportFactory), so the protocols an application does not use add nothing
to its size.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceOpens a broker transport for a URL of its scheme. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindDataSource(DataSource dataSource) Gives the calling thread's server's transport its data source: thedb:queue and the outbox live there.static MessageTransportcurrent()The transport of the calling thread's server: opened from its configuration the first time it is asked for, closed when the server stops.static StringThe consumer group a listener declared, or -- when it declared none -- the application's name (spring.application.name, thencn1.application.name), ordefault.static MessageTransportopen(Config config, DataSource dataSource) Opens the transportconfignames; the caller closes it.static voidregister(String scheme, Messaging.TransportFactory factory) Makesscheme(redis,amqp,kafka, ...) open throughfactory.static StringThe URLconfignames, or null when it names none.
-
Method Details
-
register
Makesscheme(redis,amqp,kafka, ...) open throughfactory. Called by the generated wiring, never by application code. -
bindDataSource
Gives the calling thread's server's transport its data source: thedb:queue and the outbox live there. Called by the generated wiring before any bean can send.- Throws:
IOException
-
current
The transport of the calling thread's server: opened from its configuration the first time it is asked for, closed when the server stops.- Throws:
IOException
-
group
The consumer group a listener declared, or -- when it declared none -- the application's name (spring.application.name, thencn1.application.name), ordefault.- Throws:
IOException
-
url
The URLconfignames, or null when it names none.- Throws:
IOException
-
open
Opens the transport
confignames; the caller closes it.dataSource: the server's, or null; wheredb:queues and where an outbox is kept
- Throws:
IOException
-