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

Reuse connection string #17

Open
nord- opened this issue Jun 5, 2019 · 1 comment
Open

Reuse connection string #17

nord- opened this issue Jun 5, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@nord-
Copy link

nord- commented Jun 5, 2019

Hey,
I understand that each Function needs it's own connection to the MQTT-broker. But is there a way to reuse the same connection string?

I have a need for at least three functions subscribing to the same MQTT-broker, listening for different topics. It seems redundant to have to declare three identical connection strings just to make them understand that they need a new connection...

[FunctionName("TestReceiver")]
public static void TestReceiver([MqttTrigger("test/#")]IMqttMessage message, ILogger log)
{
    log.LogInformation("TestReceiver function triggered!");

    var body = message.GetMessage();
    var bodyString = Encoding.UTF8.GetString(body);
    log.LogInformation($"TestReceiver, topic {message.Topic}: {bodyString}");
}


[FunctionName("TestDeviceReceiver")]
public static void TestDeviceReceiver([MqttTrigger("device/#")] IMqttMessage message, ILogger log)
{
    log.LogInformation("TestDeviceReceiver function triggered!");

    var body = message.GetMessage();
    var bodyString = Encoding.UTF8.GetString(body);
    log.LogInformation($"TestDeviceReceiver, topic {message.Topic}: {bodyString}");
}
@keesschollaart81 keesschollaart81 self-assigned this Jun 13, 2019
@keesschollaart81 keesschollaart81 added the enhancement New feature or request label Jun 13, 2019
@Skydragonsz
Copy link

This is still the same issue as #11
I'm trying to subscribe to different topics on the same broker but it triggers the wrong function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants