C# Queue or ServiceBus with no dependencies?

后端 未结 10 495
暗喜
暗喜 2021-01-31 10:54

Is there a product (ideally open source, but not necessary), that would enable a zero dependency deployment? every service bus or queue library I\'ve been able to find has a de

10条回答
  •  执念已碎
    2021-01-31 11:11

    If you're happy to be:

    1. Windows specific
    2. Limited to the local domain
    3. Seriously limited in the message size supported
    4. Wrap the underlying win32 calls in P/Invoke
    5. Deal with the polling yourself
    6. Deal with the hacks needed to allow back and forth communication
    7. Deal with the shared config needed to keep the names in sync

    Then a quick wrapper around the windows MailSlot API might be sufficient.

    This simple example is a reasonable basis to start.

    This article has some further information but assumes the use case is via a control (rather than a Component as it should be) as well as some poor WinForms integration so should be considered for incidental reading rather than a basis for any library.

    This article is C++ but is of a higher standard (and a commenter has extended it to support the batching of larger messages into several smaller ones).

    You get 424 bytes (so with .Net 212 chars) you may want to drop to ASCII to double your useful message length if you are talking text.

    Note that despite its simplicity, limitations and lack of features it does provide multicast delivery, something often complex to layer on a point to point protocol yourself.

提交回复
热议问题