ZeroMQ | ZeroMQ for Swift - ZeroMQ is a 0mq binding for Swift | Networking library
kandi X-RAY | ZeroMQ Summary
kandi X-RAY | ZeroMQ Summary
ZeroMQ is a 0mq binding for Swift 3.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ZeroMQ
ZeroMQ Key Features
ZeroMQ Examples and Code Snippets
Community Discussions
Trending Discussions on ZeroMQ
QUESTION
On a single process I have a tasks running on a thread that produces values and broadcasts them and several consumer async tasks that run concurrently in an asyncio loop.
I found this issue on PyZMQ's github asking async <-> sync communication
with inproc sockets which is what I also wanted and the answer was to use .shadow(ctx.underlying)
when
creating the async ZMQ Context.
I prepared this example and seems to be working fine:
...ANSWER
Answered 2022-Mar-01 at 22:12Q :
Is it safe to useinproc://*
between a thread and asyncio task in this way?""
A :
First and foremost, I might be awfully wrong (not only here), yet having worked with ZeroMQ since native API 2.1.1+ I dare claim that unless newer "improvements" got lost the core principles ( ZeroMQ ZMTP/RFC-documented properties for building legal implementation of the still valid ZMTP-arsenal ), the answer here shall be YES, as much as the newer releases of pyzmq-binding kept all mandatory properties of the inproc:
-Transport-Class without a compromise.
Q :
" The 0MQ context is thread safe and I'm not sharing sockets between the thread and theasyncio
task, so I would say in general that this is thread safe, right? "
A :
Here my troubles start - ZeroMQ implementations were since ever developed based on Martin SUSTRIK's & Pieter HINTJENS' Zen-of-Zero -- i.e. also as Zero-sharing -- so never sharing was the principle ( though "share"-zmq.Context
-instances were no problem to be used from different threads, to the contrary of the zmq.Socket
-instances )
Python (since ever & still valid in 2022-Q1) used to use & still uses a total [CONCURRENT]
-code-execution avoider -- prevented by GIL-lock, which principally avoids any & all kinds of problems, arising from [CONCURRENT]
-code-execution to never happen insider Python GIL-lock re-[SERIAL]
-ised flow of code-execution, so even if the asyncio
-part is built as a pythonic (non-destructive) part of the ecosystem, your code shall never "meet" any kind of concurrency-related issue, as the unless it gains GIL-lock, it does nothing but "hanging in NOP
-s cracking" ( nuts-cracking in idle loop ).
Being inside the same process, there seems no advantage to spawn another Context
-instance at all ( this used to be the rock-solid certainty since ever, not to ever increase any kind of overheads - Zen-of-Zero ( almost )Zero-overhead ... ). The Sig/Msg core engine was, if performance or latency needs required, powered with more zmq.Context( IOthreads )
upon instantiations, yet these were zmq.Context
-owned, not Python-GIL-governed/(b)locked threads, so the performance was pretty well scalable, without wasting any RAM/HWM/buffers/...-resources, without growing any overheads and very efficient, as the IO-threads were co-located for only indeed I/O-work, so not needed for inproc:
-( protocol-less )-Transport-Class at all )
Q :
" Or am I missing something that I should consider? "
A :
Mixing asyncio
, O/S-signals ( that are well documented how they interact with native ZeroMQ API ) and other layers of complexity is for sure possible, yet it comes at a cost - it makes the use-case less and less readable and more and more prone to conceptual-gaps and similar hard to decode "errors".
I remember using Tkinter-mainloop()
as a cost-wise very cheap and a super-stable framework for rapid-prototyping an MVC-{ M-odel, V-isual, C-ontroller }-parts of many-actors' indeed distributed-system applications in Python. There were Zerop-problems to use ZeroMQ with a single Context
-instance, passing the references of the respective AccessNodes' into whatever amount of event-handlers, supposing we kept the ZeroMQ Zen-of-Zero, i.e. no to "share" (meaning no two parts "use" (compete to use) one and the same AccessPoint "one-over-another")
This all was designed-in, at "Zero-cost", by the ZeroMQ by-definition, so unless spoilt in some later phase, re-wrapping a re-wrapped native API, all this ought still work in 2022-Q1, ought it not?
QUESTION
Community,
I want to use
/subscribe
a to a pub
-socket on a server that implements ZeroMQ (https://zeromq.org/)
My final product will be a flutter app. It must be running on Android/iOS/Windows/MacOS/Linux/Web. So I'm really careful with the plugin-choice. I do not want to burden myself with an intense amount of platform-specific code, neither do I want to be dependent on plugins that might break
under certain conditions on each platform.
I know that there is a ZeroMQ-Plugin, but it has some Unresolved Issues in terms of operability on different platforms. Also I tried to run it on different Windows-machines and it only worked in about 25% of the cases.
Here's the fundamental network-communication between App and Server (see image below).
Is it possible to connect to a ZeroMQ-Publisher-Socket WITHOUT implementing or depending on the C++ compiled file of ZeroMQ? I'm thinking of a Socket
or WebSocket
, but I'm not even sure if it's technically possible (protocol etc), as I think that ZeroMQ uses it's own protocoll (please verify).
Can I subscribe to a ZeroMQ-Publisher-Socket with Sockets
or WebSockets
in Flutter? If yes, how? Are there alternatives?
Best regards
...ANSWER
Answered 2022-Feb-17 at 19:36Q1 :
"Is it possible to connect to a ZeroMQ-Publisher-Socket WITHOUT implementing or depending on the C++ compiled file of ZeroMQ?"
A1 :
Yes, it is. It is quite enough to re-implement the published ZeroMQ ZMTP RFC-s relevant for the use-case & your code is granted to become interoperable, irrespective of the implementation language / deployment ecosystem, if it meets all the ZMTP RFC-s' mandatory requirements. So it is doable.
Q2 :
"... ZeroMQ uses it's own protocoll (please verify)."
A2 :
No, in the sense of OSI-ISO-L2/L3 stack.
Yes, in the sense of higher layer application-driven protocols, where the ZMTP RFC-s apply for the most of the ZeroMQ Scalable Formal Communication Patterns' Archetypes ( may read more on ZeroMQ sockets are not sockets as you know them ), yet there are also tools to interface with O/S plain-sockets' fd
-s, where needed. Still A1 applies here.
Q3 :
"Can I subscribe to a ZeroMQ-Publisher-Socket with ...? If yes, how?"
A3 :
Yes, it possible when your code follows the published ZMTP RFC-s. Implement all ZMTP RFC-s' mandatory properties & you are granted an interoperability with any other, ZeroMQ-ZMTP-RFC-s' compliant, node.
Q4 :
"Are there alternatives?"
A4 :
Yes, if your design can extend the Server-side, adding another AccessPoint-s there, using ZMQ_STREAM
Scalable Formal Communication Archetype there, may reduce your Flutter-side scope of ZMTP RFC-s needed, as interfacing to native plain-socket will be the only one to handle and the "functionality gap" thereof can be handled on the Server-side of the link ( easily handling all the subscription management & message filtering, that must meet the ZeroMQ ZMTP RFC-s, so why not tandem it inside the Server-side before connecting the down-stream to Flutter App - smart, isn't it? )
QUESTION
I am currently struggling to find the python headers on my system and can't include them therefore into a C++ application
this is my cmake file -->
...ANSWER
Answered 2022-Jan-24 at 09:32It seems to me that the first problem is with the order of these lines:
QUESTION
I want to allow a client to send a task to some server at a fixed address. The server may take that task and perform it at some arbitrary point in the future, but may still take requests from other clients before then. After performing the task, the server will reply to the client, which may have been running a blocking wait on the reply. The work and clients come dynamically, so there can't be a fixed initial number. The work is done in a non-thread-safe context, so workers can't exist on different threads, so all work should take place in a single thread.
ImplementationThe following example1 is not a complete implementation of the server, only a compilable section of the sequence that should be able to take place (but is in reality hanging). Two clients send an integer each, and the server takes one request, then the next request, echo replies to the first request, then echo replies to the second request. The intention isn't to get the responses ordered, only to allow for the holding of multiple requests simultaneously by the server. What actually happens here is that the second worker hangs waiting on the request - this is what confuses me, as DEALER sockets should route outgoing messages in a round-robin strategy.
...ANSWER
Answered 2022-Jan-23 at 12:51Let me share a view on how ZeroMQ could meet the above defined Intention
.
Let's rather use ZeroMQ Scalable Formal Communication Pattern Archetypes ( as they are RTO now, not as we may wish them to be at some, yet unsure, point in (a just potentially happening) future evolution state ).
We need not hesitate to use many more ZeroMQ-based connections among a herd of coming/leaving client
-instance(s) and the server
For example :
Client .connect()
-s a REQ
-socket to Server-address:port
-A to ask for a "job"-ticket processing over this connection
Client .connect()
-s a SUB
-socket to Server-address:port
-B to listen ( if present ) about published announcements about already completed "job"-tickets that are Server-ready to deliver results for
Client exposes another REQ
-socket to request upon an already broadcast "job"-ticket completion announcement message, it has just heard about over the SUB
-socket, to get "job"-ticket results finally delivered, if proving itself, by providing a proper / matching job-ticket-AUTH-key
to proof its right to receive the publicly announced results' availability, using this same socket to deliver a POSACK-message to Server upon client has correctly received this "job"-ticket results "in hands"
Server exposes REP
-socket to respond each client ad-hoc upon a "job"-ticket request, notifying this way about having "accepted"-job-ticket, delivering also a job-ticket-AUTH-key
for later pickup of results
Server exposes PUB
-socket to announce any and all not yet picked-up "finished"-job-tickets
Server exposes another REP
-socket to receive any possible attempt to request to deliver "job"-ticket-results. Upon verifying there delivered job-ticket-AUTH-key
, Server decides whether the respective REQ
-message had matching job-ticket-AUTH-key
to indeed deliver a proper message with results, or whether a match did not happen, in which case a message will carry some other payload data ( logic is left for further thoughts, so as to prevent potential bruteforcing or eavesdropping and similar, less primitive attacks on stealing the results )
Clients need not stay waiting for results live/online and/or can survive certain amounts of LoS, L2/L3-errors or network-storm stresses
Clients need just to keep some kind of job-ticket-ID
and job-ticket-AUTH-key
for later retrieving of the Server-processes/maintained/auth-ed results
Server will keep listening for new jobs
Server will accept new job-tickets with providing a privately added job-ticket-AUTH-key
Server will process job-tickets as it will to do so
Server will maintain a circular-buffer of completed job-tickets to be announced
Server will announce, in due time and repeated as decided in public, job-tickets, that are ready for client-initiated retrieval
Server will accept new retrieval requests
Server will verify client-requests for matching any announced job-ticket-ID
and testing if job-ticket-AUTH-key
match either
Server will respond to either matching / non-matching job-ticket-ID
results retrieval request(s)
Server will remove a job-ticket-ID
from a circular-buffer only upon both POSACK-ed AUTH-match before a retrieval and a POSACK-message re-confirmed delivery to client
QUESTION
I install new modules via the following command in my miniconda
...ANSWER
Answered 2022-Jan-06 at 20:11Consider creating a separate environment, e.g.,
QUESTION
I'm using python's pyzmq==22.2.1 which should support ZeroMQ 4.2.0 (according to the API)
I'm trying to make use of the heartbeat socket options (ZMQ_HEARTBEAT_IVL
, ZMQ_HEARTBEAT_TIMEOUT
and ZMQ_HEARTBEAT_TTL
). However, when I set these socket options, I am not receiving the expected TimeoutException or any exception on my socket. It just seems to sit there doing nothing.
What is the expected behaviour after setting these socket options ? On the server side, how does the server detect the client has timeout and missed a heartbeat and vice versa for the client (is there an exception or something that's supposed to be thrown or something ?).
I've setup a simple router-dealer echo example below:
...ANSWER
Answered 2022-Jan-07 at 12:13Q : What is the expected behaviour after setting these socket options ?
A :
well,
there are two-fold effect of the said settings. One, that actually works for your setup goals ( i.e. going & sending (most probably ZMTP/3.1) ZMTP_PING
connection-oriented service-sublayer "ZMTP/3.1-service-packets" and reciprocally, not sure, but most often, adequately formed "ZMTP/{3.1|2.x|1.0}-service-packets" (hopefully delivered) back. These "service-packets" are visible on the wire-line (if present - an inproc://
-transport-class and vmci://
-transport-class too have no actual wire a typical user can hook-on and sniff-traffic in, but some kind of pointer-acrobatics used for RAM-mapping), so a protocol-analyser will "see" them id decodes like this:
QUESTION
Good day
I am getting an error while importing my environment:
...ANSWER
Answered 2021-Dec-03 at 09:22Build tags in you environment.yml are quite strict requirements to satisfy and most often not needed. In your case, changing the yml file to
QUESTION
I am new to jest, sorry if this is a trivial question but I went through the official jest docs and I am not able to find a solution to the problem.
I am developing a very simple app in nodejs that consumes data from a websocket and propagates it downstream to a set of consumers via zeromq.
The code is the following:
app.js:
...ANSWER
Answered 2021-Nov-19 at 04:48After mocking by jest.mock()
, when the .wsClient()
and .zmqSock()
methods are called in the app.js
file and app.spec.js
file, the sock
and ws
objects in app.js
are different with the app.spec.js
.
QUESTION
I have Dockerfile based on Alpine linux that builds lambda.zip file for AWS Lambda. Here's Dockerfile:
...ANSWER
Answered 2021-Oct-02 at 21:43You are installing some statically compiled dependencies in your Docker environment, like libc-dev
, geos-dev
, and geos
. You have to also include those static dependencies in the Lambda deployment zip file. Also, to include statically compiled dependencies for use in AWS Lambda you have to use the same operating system Lambda uses, which is Amazon Linux, not Alpine Linux.
Luckily there are two alternatives now that make this much easier:
Lambda Layers are Lambda dependencies that can be packaged up in a reusable method, that can also be shared with other developers. In this case someone has already created a shapely Lambda Layer (and someone else here) that you can simply include in your Lambda function instead of trying to package it yourself.
If you still want to build it yourself you could look at that project's source code to see how they are building the layer.
Instead of creating a zip deployment, you could create a Docker image and deploy it to Lambda. You do have to implement a specific interface inside your Lambda container if you go this route, and it is easiest to do this by starting with one of the official AWS Lambda base images.
QUESTION
I had just installed Anaconda from anaconda.com. The installation proceeded smoothly. After that, I was trying to create a new environment from this environment.yml file. (nbdev.yml)
...ANSWER
Answered 2021-Aug-04 at 05:11After a lot of research, I stumbled on to Mamba doesn't find a solution when mixing conda forge defaults and not specifying Python explicitly 1102. So I just edited nbdev.yml from
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ZeroMQ
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page