Enables and configures the Angular Solace Message Client, returning a set of dependency-injection providers to be registered in Angular.
The Solace Message Client provides API to communicate with a Solace messaging broker for sending and receiving messages using the native SMF protocol (Solace Message Format).
An application is not limited to connecting to a single Solace Message Broker. Different injection environments can be used to connect to different brokers.
Angular injection environments form a hierarchy, inheriting providers from parent environments. An environment can register new providers or replace inherited providers.
A child environment is created through routing or programmatically using createEnvironmentInjector.
bootstrapApplication(AppComponent, { providers: [ provideSolaceMessageClient(), {provide:LogLevel, useValue:LogLevel.INFO}, // Add this line ], });
To change the log level at runtime, add the angular-solace-message-client#loglevel entry to session storage
and reload the application. Supported log levels are: trace, debug, info, warn, error and fatal.
Storage Key: angular-solace-message-client#loglevel
Storage Value: info
Configures SolaceMessageClient.
Can be an object or a function to provide the config asynchronously.
The function can call inject to get any required dependencies.
Enables and configures the Angular Solace Message Client, returning a set of dependency-injection providers to be registered in Angular.
The Solace Message Client provides API to communicate with a Solace messaging broker for sending and receiving messages using the native SMF protocol (Solace Message Format).
Setup
Alternatively, a function can be passed to load the config asynchronously. The function can call
inject
to get any required dependencies.The connection to the broker will be established when
SolaceMessageClient
is injected for the first time.Usage
Publish a message to a topic
Receive messages sent to a topic
Connect to Multiple Solace Message Brokers
An application is not limited to connecting to a single Solace Message Broker. Different injection environments can be used to connect to different brokers.
Angular injection environments form a hierarchy, inheriting providers from parent environments. An environment can register new providers or replace inherited providers. A child environment is created through routing or programmatically using
createEnvironmentInjector
.Example for connecting to two different brokers:
Logging
The default log level is set to
WARN
so that only warnings and errors are logged.The default log level can be changed as follows:
To change the log level at runtime, add the
angular-solace-message-client#loglevel
entry to session storage and reload the application. Supported log levels are:trace
,debug
,info
,warn
,error
andfatal
.Storage Key:
angular-solace-message-client#loglevel
Storage Value:info