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

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

Open
miaooss opened this issue Apr 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@miaooss
Copy link

miaooss commented Apr 12, 2024

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.
@miaooss miaooss added the bug Something isn't working label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant