Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for connecting to multiple brokers in the same application #71

Closed
danielwiehl opened this issue Sep 21, 2023 · 1 comment
Closed
Milestone

Comments

@danielwiehl
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

The Solace Message Client can only connect to a single broker. It is not possible to have multiple message clients that connect to different brokers.

Describe the solution you'd like

Support for creating a message client instance per broker.

@danielwiehl danielwiehl added this to the 2024-02 milestone Sep 21, 2023
@danielwiehl
Copy link
Collaborator Author

Planned for PI 2024-02.

danielwiehl added a commit that referenced this issue May 13, 2024
…ssage brokers

An application is not limited to connecting to a single Solace Message Broker. Different environments can be used to connect to different brokers.

Example for connecting to two different brokers:

```ts
import {createEnvironmentInjector, EnvironmentInjector, inject} from '@angular/core';
import {provideSolaceMessageClient, SolaceMessageClient} from '@solace-community/angular-solace-message-client';

// Configure environment to provide message client for broker 1.
const environment1 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-1'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient1 = environment1.get(SolaceMessageClient);
// Publish message to broker 1.
messageClient1.publish('topic', 'message for broker 1');

// Configure environment to provide message client for broker 2.
const environment2 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-2'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient2 = environment2.get(SolaceMessageClient);
// Publish message to broker 2.
messageClient2.publish('topic', 'message for broker 2');

// Destroy environments to destroy provided `SolaceMessageClient` instances.
environment1.destroy();
environment2.destroy();
```

closes #71
@danielwiehl danielwiehl mentioned this issue May 13, 2024
17 tasks
danielwiehl added a commit that referenced this issue May 14, 2024
…ssage brokers

An application is not limited to connecting to a single Solace Message Broker. Different environments can be used to connect to different brokers.

Example for connecting to two different brokers:

```ts
import {createEnvironmentInjector, EnvironmentInjector, inject} from '@angular/core';
import {provideSolaceMessageClient, SolaceMessageClient} from '@solace-community/angular-solace-message-client';

// Configure environment to provide message client for broker 1.
const environment1 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-1'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient1 = environment1.get(SolaceMessageClient);
// Publish message to broker 1.
messageClient1.publish('topic', 'message for broker 1');

// Configure environment to provide message client for broker 2.
const environment2 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-2'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient2 = environment2.get(SolaceMessageClient);
// Publish message to broker 2.
messageClient2.publish('topic', 'message for broker 2');

// Destroy environments to destroy provided `SolaceMessageClient` instances.
environment1.destroy();
environment2.destroy();
```

closes #71
danielwiehl added a commit that referenced this issue May 14, 2024
…ssage brokers

An application is not limited to connecting to a single Solace Message Broker. Different environments can be used to connect to different brokers.

Example for connecting to two different brokers:

```ts
import {createEnvironmentInjector, EnvironmentInjector, inject} from '@angular/core';
import {provideSolaceMessageClient, SolaceMessageClient} from '@solace-community/angular-solace-message-client';

// Configure environment to provide message client for broker 1.
const environment1 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-1'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient1 = environment1.get(SolaceMessageClient);
// Publish message to broker 1.
messageClient1.publish('topic', 'message for broker 1');

// Configure environment to provide message client for broker 2.
const environment2 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-2'})], inject(EnvironmentInjector));
// Inject message client.
const messageClient2 = environment2.get(SolaceMessageClient);
// Publish message to broker 2.
messageClient2.publish('topic', 'message for broker 2');

// Destroy environments to destroy provided `SolaceMessageClient` instances.
environment1.destroy();
environment2.destroy();
```

closes #71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant