Coder Social home page Coder Social logo

mqttnet.orleans's Introduction

Temporarily Archiving This Repository

Due to the fact that the MQTT Server classes are not yet 100% stable, this repository will be archived for the time being. If/when the libraries are finally stabilized, this repository will be re-activated and updated to use the newer MQTTnet libraries (possibly the v3.x libs, but definitely TBD)

If the server libs become stable, and the repository is not yet re-activated, please contact me: duncan16 at comcast.net and I will put the time in to update this library to support the server architecture for those that are using Orleans as a backplane.

Thanks!

MQTTnet.Orleans

Although MQTTnet has both a client and server component within its library, there is no ability natively to load-balance the work across multiple host nodes. MQTTnet.Orleans is an implementation using Orleans as a backplane to enable load-balancing scenarios, with the added benefit of allowing any Orleans Client the ability to address the device without needing a significant amount of infrastructure.

Orleans Silo Configuration

Note: Most of the configuration is done for you already. As the implementor, call .UseMqtt() on the SiloHostBuilder object.

static async Task Main(string[] args)
{
    // other config stuff.
    // ...
    //

    var silo = new SiloHostBuilder()
        .UseMqtt()
        .Build();
    
    // other config stuff.
    // ...
    //
}

Note-2: It may be beneficial to create a grain which abstracts or otherwise encapsulates the MQTT calls. We have done this in our implementation project which is where this project is rooted from.

Orleans Client Configuration

public void ConfigureServices(IServiceCollection services)
{
    services.AddHostedOrleansMqttServer((builder) =>
        {
            builder
                .WithDefaultEndpoint()
                .WithDefaultEndpointPort(9876)
                .WithConnectionValidator(async (ctx) =>
                {
                    // any connection validation code you need goes in here.
                });
        })
        .AddMqttTcpServerAdapter(); // can be tcp server; websocket bits; etc.
}

Nginx Ingress Configuration

If using WebSockets, ensure that you not only set the kubernetes ingress to enable websockets with the nginx.ingress.kubernetes.io/websocket-services annotation, but also include the affinity, session cookie hash, and session cookie neame annotations. Without these items, your clients will not be kicked between reloads of the mqtt websocket service.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {your service}
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"
    nginx.org/websocket-services: "{your service}"
    nginx.ingress.kubernetes.io/websocket-services: "{your service}"
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/session-cookie-hash: sha1
    nginx.ingress.kubernetes.io/session-cookie-name: REALTIMESERVERID
    nginx.ingress.kubernetes.io/ssl-ciphers: "ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5"
    nginx.ingress.kubernetes.io/proxy-buffer-size: "64k"
    nginx.ingress.kubernetes.io/proxy-buffering: "on"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts: 
    - host1.domain.com
    - host2.domain.com
    - host3.domain.com
    secretName: tls-secret
  rules:
  - host: host1.domain.com
    http:
      paths:
      - path: /bus
        backend:
          serviceName: {your service}
          servicePort: 5000

mqttnet.orleans's People

Contributors

dealproc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mqttnet.orleans's Issues

Determine if multiple servers will communicate with all device instances

When using MQTTnet.Orleans with multiple silos and/or multiple MQTTNet servers, we need to verify that a command which is to be pushed to all device instances (e..g. /devices/ping) will indeed hit all devices across all MQTTnet instances and/or silos. In the event that it does not, we need to determine what would be needed in this case to ensure that it would happen as expected.

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.