Git Product home page Git Product logo

Comments (4)

xydan83 avatar xydan83 commented on August 16, 2024 1

Hi! I opened a pull request...

from aiomqtt.

frederikaalund avatar frederikaalund commented on August 16, 2024

Hi xydan83. Thanks for opening this issue. Let me have a look. :)

Indeed, asyncio-mqtt doesn't expose the message_retry parameter yet. I think it's a good idea to add it. πŸ‘ Maybe as a keyword argument to Client.__init__. Should only be a couple of lines of code.

Do you want to submit a pull request with this change?

from aiomqtt.

xydan83 avatar xydan83 commented on August 16, 2024

Sorry for the late reply. Yes, I can make a pull request.
At the moment I got around this by inheritance, but it doesn't look very good.

from asyncio_mqtt import Client as MQTT_Client

class WrapMQTTClient(MQTT_Client):
    """
     A wrapper class for the MQTT_Client class to implement the missing features
    """
    def __init__(self, hostname: str,
                 port: int = 1883,
                 username: Optional[str] = None,
                 password: Optional[str] = None,
                 logger: Optional[logging.Logger] = None,
                 client_id: Optional[str] = None,
                 tls_context: Optional[ssl.SSLContext] = None,
                 protocol: Optional[ProtocolVersion] = None,
                 will: Optional[Will] = None,
                 clean_session: Optional[bool] = None,
                 transport: str = "tcp",
                 keepalive: int = 60,
                 bind_address: str = "",
                 bind_port: int = 0,
                 clean_start: bool = mqtt.MQTT_CLEAN_START_FIRST_ONLY,
                 properties: Optional[Properties] = None,
                 message_retry_set: int = 20): # <--- This is a new param
        super().__init__(hostname=hostname,
                         port=port,
                         username=username,
                         password=password,
                         logger=logger,
                         client_id=client_id,
                         tls_context=tls_context,
                         protocol=protocol,
                         will=will,
                         clean_session=clean_session,
                         transport=transport,
                         keepalive=keepalive,
                         bind_address=bind_address,
                         bind_port=bind_port,
                         clean_start=clean_start,
                         properties=properties)
        # The parameter was not passed in async_mqtt, 
        # which sets the time after which Paho will resend the message if QoS> 0.
        self._client.message_retry_set(message_retry_set)

from aiomqtt.

frederikaalund avatar frederikaalund commented on August 16, 2024

Thanks for the PR. πŸ‘ I merged into master. :)

from aiomqtt.

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.