Code Monkey home page Code Monkey logo

Comments (4)

chkr1011 avatar chkr1011 commented on July 17, 2024

What exactly means "no result". Is there null returned or is there a wrong reason code?

from mqttnet.

SeppPenner avatar SeppPenner commented on July 17, 2024

public async Task Foo(byte[] data)
{
await _mqttPublisher.Publish(topic1, data);
await _mqttPublisher.Publish(topic2, data); // continues even though we didn't get a result nor exception
await _mqttPublisher.Publish(topic3, data);
}

How do you expect to get a result if you don't read it into a variable? await _mqttPublisher.Publish(topic2, data); will always proceed unless an exception is thrown and that is alright?

What about something like:

public async Task Foo(byte[] data)
{
    var x = await _mqttPublisher.Publish(topic1, data);
    var y = await _mqttPublisher.Publish(topic2, data); // continues even though we didn't get a result nor exception
    var z = await _mqttPublisher.Publish(topic3, data);
}

from mqttnet.

don-pironet-hatch avatar don-pironet-hatch commented on July 17, 2024

What I would expect is that this line:

var result = await _mqttClient.PublishAsync(applicationMessageBuilder.Build(), CancellationToken.None);
always have a result stored in that property before returning. And if there is an exception that an exception is thrown. Now we see that it publishes the mqtt command but before the PublishAsync ends we are already executing the next commands

from mqttnet.

chkr1011 avatar chkr1011 commented on July 17, 2024

@don-pironet-hatch Please provide a full running example to that we can try to reproduce the problem. The code you posted contains a _mqttPublisher where the implementation is not clear and how it works internally.

from mqttnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.