Skip to content

When the server is Sending a Message, the message get descarded from the MqttRouter #12

Open
@miaooss

Description

@miaooss

Describe the bug

Inside one of the controller Route I'm using this code to send an message to all subscriber
// Now inject the new message at the broker.
await Server.InjectApplicationMessage(new InjectedMqttApplicationMessage(msg)
{
SenderClientId = MqttServerConstants.ClientId
});

But What I found is an error on the Logs saying that the Message will be drop

logger.LogDebug($"Rejecting message publish because '{context.ApplicationMessage.Topic}' did not match any known routes.");

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of MQTTnet 4.X.X

  2. Create a controller then send a message using Server.InjectApplicationMessage

  3. Make sure you are using:
    app.UseMqttServer(server =>
    {
    server.WithAttributeRouting(app.ApplicationServices, allowUnmatchedRoutes: false);
    });

  4. See error.

Expected behavior

A clear and concise description of what you expected to happen.

Need the ability to ignore the Server message from the router
by maybe looking at the sender id

Screenshots

None

Additional context / logging

Using this example
https://github.com/dotnet/MQTTnet/blob/7f5c437c46dd52ecb1d53dfc8ea9fb8ff46caf5d/Samples/Server/Server_Simple_Samples.cs#L53C12-L53C55

dbug: MQTTnet.AspNetCore.Routing.MqttRouter[0]
      Rejecting message publish because 'route/path' did not match any known routes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions