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
Alternative for ClientMessageQueueInterceptor in V4.x.x? #1648
Comments
Intercepting publishYou can see how to intercept publish events here. For checking whether the message was sent by the server you use To get the topic you can still use To stop the message from being published, you can use Intercepting packetsUse
However, if you really need to check, whether the sender is the Server, I think you are out of luck with this method. |
I added a similar event for version 4.0. Please either check the code from the branch attached to this ticket or use the build 651 from the myget feed (see link in readme). If that new event works for you I will merge this feature. |
I need a similar feature for some projects, I checked the code for new InterceptingClientEnqueueEvent and it looks good. |
@chkr1011 I'll check out the branch this morning and run it with our code. |
@chkr1011 currently I'm using this code snippet adapted from @Jeanot-Zubler suggestion above which mostly works.
Unfortunately the clients are registered with a "request/+" which is leading a duplication of requests amongst the listening clients, which I'll need to investigate further. If the former functionality through the ClientMessageQueueInterceptor could be restored it would be much appreciated. |
@RossHNPC Please let me know if the code from the branch works then I will merge the feature. |
@chkr1011 yes code working and that's restored the old functionality. Thank you for adding this back in. |
@chkr1011 Do you have an ETA for the next official Release to NuGet? We can use a build a of the 1648 branch for testing, but would rather be using an official NuGet package in production. |
I assume it will be released within the next two weeks. |
@chkr1011 I've discovered a problem with this. If we have 3 Clients subscribed to 'request/+' as a topic. When the MqttClientSessionsManager is iteratting through the subscriberSessions ~line 184 it works perfectly, until you reach the InterceptingClientEnqueueEvent. If we are processing subscriptions for Clients A,B & C: if A is processed by the EnqueueEventHandler and returns with AcceptEnqueue = false then the loop exits without Client B&C being checked. Similarly if A has AcceptEnqueue = true but B has AcceptEnqueue = false then Client C will not be tested. I'll try to make a fix for this; but not fully knowing the code base I can't promise it won't break anything :-( |
@chkr1011 fairly certain it should just be a continue statement and that would allow the code to progress through the subscriptions without exiting early. |
How to replicate functionality when the ClientMessageQueueInterceptor has been removed.
We're working on upgrading an existing codebase that currently uses v2.x.x release of MqttNet.
Mostly going well, but I'm unable to determine a replacement for the following code snippet.
Investigating this; the messages that we send from the server should go to specific clients; we determine this be examining the messages for a blank ClientId then comparing the RecieverClientId to a screened list.
Searching the current code base, SenderClientId, ReceiverClientsId and AcceptEnqueue all appear to be historical.
Is there a similar to intercept the ApplicationMessages where the Sender and Recevier ClientIds are available as they are being published in the current version of MqttNet?
Which project is your question related to?
The text was updated successfully, but these errors were encountered: