Recent Forum Posts
From categories:
page 1123...next »
Giordano (guest) 16 Apr 2018 15:30
in discussion Hidden / Per page discussions » 0MQ Termination

Bump. I do have the exact same problem and I hope someone will answer. Thanks.

by Giordano (guest), 16 Apr 2018 15:30
Alexey (guest) 23 Mar 2018 17:28
in discussion Hidden / Per page discussions » 0MQ Termination

Anyone?
How do I terminate zmq_proxy?

by Alexey (guest), 23 Mar 2018 17:28

I have written a demo Windows service using POCO library.
As per POCO API the function waitForTerminationRequest() waits for a service termination request.

Now, in this POCO based windows service, I want to start a ZeroMQ library based Message Queue proxy to implement an XSUB/XPUB message queue.
From this service I will be running a xsub-xpub proxy.

More can be learnt here zguide.zeromq.org page:all.

For this I wrote another class ZeroMQProxy, which starts the proxy in the service's main function.

class ZeroMQProxy
{
private:
    zmq::context_t context;
    zmq::socket_t xsub;
    zmq::socket_t xpub;

public:
    ZeroMQProxy()
        : context(1),
        xsub(context, ZMQ_XSUB),        // Publisher End Proxy Sockets
        xpub(context, ZMQ_XPUB)         // Subscriber End Proxy Sockets
    {
    }

    ~ZeroMQProxy()
    {
    }

    void proxyopen()
    {
        xsub.bind("tcp://*:5559");
        xpub.bind("tcp://*:5560");

        zmq::proxy(xsub, xpub, nullptr);
    }

    void proxyclose()
    {
    }
};

class demopocoservice : public ServerApplication
{
private:
    bool _helpRequested;

public:
    demopocoservice() : _helpRequested(false)
    {
    }

    ~demopocoservice()
    {
    }

protected:
    void initialize(Application& self)
    {
        loadConfiguration();
        ServerApplication::initialize(self);
    }

    void uninitialize()
    {
        ServerApplication::uninitialize();
    }

    void defineOptions(OptionSet& options)
    {
        ServerApplication::defineOptions(options);

        options.addOption(
            Option("help", "h", "poco display help")
            .required(false)
            .repeatable(false)
            .callback(OptionCallback<demopocoservice>(
                this, &demopocoservice::handleHelp)));
    }

    void handleHelp(const std::string& name,
        const std::string& value)
    {
        _helpRequested = true;
        displayHelp();
        stopOptionsProcessing();
    }

    void displayHelp()
    {
        HelpFormatter helpFormatter(options());
        helpFormatter.setCommand(commandName());
        helpFormatter.setUsage("OPTIONS");
        helpFormatter.setHeader("poco: Zero message Queue.");
        helpFormatter.format(std::cout);
    }

    int main(const ArgVec& args)
    {
        if (!_helpRequested)
        {
            ZeroMQProxy zmqproxyObj;
            zmqproxyObj.proxyopen();

            waitForTerminationRequest();

            zmqproxyObj.proxyclose();
        }
        return Application::EXIT_OK;
    }
};

int main(int argc, char** argv)
{
    cout << "Hello Poco ZMQ\n";

    demopocoservice pobj;
    pobj.run(argc, argv);

    return 0;
}

My aim was when I start the service then the zmq::proxy() should have started the proxy and when I stop the service then proxy should be closed along with the sockets.

Problem is zmq::proxy() does not return back. So I am not able to stop the service.
Even if I do net stop <service name> the waitForTerminationRequest() does not receive termination request because of zmq::proxy().

I had tried calling the proxy() in a poco runnable thread. But it did not help.

class ZMQThread : public Poco::Runnable
{
private:
    std::string name;
    int value;

public:

    ZMQThread(const std::string& arg1, int arg2) : name(arg1), value(arg2)
    {
    }

    ~ZMQThread()
    {
    }

    void run()
    {
           ZeroMQProxy zmqproxyObj;
           zmqproxyObj.proxyopen();
    }
};

Then called the thread as

            MQThread mqOne("Poco One", 4);
            Poco::Thread threadOne;
            threadOne.start(mqOne);
            threadOne.join();

What should I do to stop/close the proxy when I stop the service?

I have written a demo Windows service using POCO library.
As per POCO API the function waitForTerminationRequest() waits for a service termination request.

Now, in this POCO based windows service, I want to start a ZeroMQ library based Message Queue proxy to implement an XSUB/XPUB message queue.
From this service I will be running a xsub-xpub proxy.

More can be learnt here zguide.zeromq.org page:all.

For this I wrote another class ZeroMQProxy, which starts the proxy in the service's main function.

class ZeroMQProxy
{
private:
    zmq::context_t context;
    zmq::socket_t xsub;
    zmq::socket_t xpub;

public:
    ZeroMQProxy()
        : context(1),
        xsub(context, ZMQ_XSUB),        // Publisher End Proxy Sockets
        xpub(context, ZMQ_XPUB)         // Subscriber End Proxy Sockets
    {
    }

    ~ZeroMQProxy()
    {
    }

    void proxyopen()
    {
        xsub.bind("tcp://*:5559");
        xpub.bind("tcp://*:5560");

        zmq::proxy(xsub, xpub, nullptr);
    }

    void proxyclose()
    {
    }
};

class demopocoservice : public ServerApplication
{
private:
    bool _helpRequested;

public:
    demopocoservice() : _helpRequested(false)
    {
    }

    ~demopocoservice()
    {
    }

protected:
    void initialize(Application& self)
    {
        loadConfiguration();
        ServerApplication::initialize(self);
    }

    void uninitialize()
    {
        ServerApplication::uninitialize();
    }

    void defineOptions(OptionSet& options)
    {
        ServerApplication::defineOptions(options);

        options.addOption(
            Option("help", "h", "poco display help")
            .required(false)
            .repeatable(false)
            .callback(OptionCallback<demopocoservice>(
                this, &demopocoservice::handleHelp)));
    }

    void handleHelp(const std::string& name,
        const std::string& value)
    {
        _helpRequested = true;
        displayHelp();
        stopOptionsProcessing();
    }

    void displayHelp()
    {
        HelpFormatter helpFormatter(options());
        helpFormatter.setCommand(commandName());
        helpFormatter.setUsage("OPTIONS");
        helpFormatter.setHeader("poco: Zero message Queue.");
        helpFormatter.format(std::cout);
    }

    int main(const ArgVec& args)
    {
        if (!_helpRequested)
        {
            ZeroMQProxy zmqproxyObj;
            zmqproxyObj.proxyopen();

            waitForTerminationRequest();

            zmqproxyObj.proxyclose();
        }
        return Application::EXIT_OK;
    }
};

int main(int argc, char** argv)
{
    cout << "Hello Poco ZMQ\n";

    demopocoservice pobj;
    pobj.run(argc, argv);

    return 0;
}

My aim was when I start the service then the zmq::proxy() should have started the proxy and when I stop the service then proxy should be closed along with the sockets.

Problem is zmq::proxy() does not return back. So I am not able to stop the service.
Even if I do net stop <service name> the waitForTerminationRequest() does not receive termination request because of zmq::proxy().

I had tried calling the proxy() in a poco runnable thread. But it did not help.

class ZMQThread : public Poco::Runnable
{
private:
    std::string name;
    int value;

public:

    ZMQThread(const std::string& arg1, int arg2) : name(arg1), value(arg2)
    {
    }

    ~ZMQThread()
    {
    }

    void run()
    {
           ZeroMQProxy zmqproxyObj;
           zmqproxyObj.proxyopen();
    }
};

Then called the thread as

MQThread mqOne("Poco One", 4);
            Poco::Thread threadOne;
            threadOne.start(mqOne);
            threadOne.join();

What should I do to stop/close the proxy when I stop the service?

Yes, still available if anybody interested.

Re: Meininger room share by opedrosoopedroso, 01 Feb 2018 13:21
Re: Meininger room share by chubbsonchubbson, 28 Jan 2018 21:16
mr G (guest) 27 Jan 2018 19:52
in discussion Hidden / Per page discussions » Broker vs. Brokerless

busy for 7 years!

by mr G (guest), 27 Jan 2018 19:52

To install DPDK and TLDK on Debian 8/9 or Ubuntu 16.04/17.10, follow the instructions at:

software.opensuse .org/download.html?project=home%3Abluca%3Azmqers&package=libtldk-dev

You can then link to the tldk libraries with pkgconfig —libs tldk

I got last available room a Meininger hotel (couple blocks from venue), Feb 1st - Feb 4th.
This room has three beds, but I can only use one.
Two more beds available for takers, 45 Euros/night.
Breakfast at hotel is good 7 Euros more, if interested.

Meininger room share by opedrosoopedroso, 17 Jan 2018 11:19
Jiri Kukacka (guest) 16 Jan 2018 12:46
in discussion Hidden / Per page discussions » ZeroMQ Pre-Fosdem Hackaton (Thu 1 + Fri 2 Feb 2018)

I'd really appreciate if it would be possible to create some comparison between ZMQ and other data transfer methods, such as other frameworks, database-based sharing, file-based sharing, etc. to help user decide how and where to use ZMQ. Thanks.

by Jiri Kukacka (guest), 16 Jan 2018 12:46
Sampad B Mohanty (guest) 31 Oct 2017 14:13
in discussion Hidden / Per page discussions » Broker vs. Brokerless

9 years and month(s) since last revisit.

by Sampad B Mohanty (guest), 31 Oct 2017 14:13

I've added a couple of topics, just possible ideas, by no means definitive.

by Luca BoccassiLuca Boccassi, 31 Aug 2017 12:25
Glenn (guest) 21 Jun 2017 01:24
in discussion Hidden / Per page discussions » NORM Transport Notes

From src/norm_engine.cpp:

        //NormSetTTL(norm_session, options.multicast_hops);  // ZMQ default is 1
        NormSetTTL(norm_session, 255);  // since the ZMQ_MULTICAST_HOPS socket option isn't well-supported

Is there any information on which platforms don't support ZMQ_MULTICAST_HOPS very well?
by Glenn (guest), 21 Jun 2017 01:24

@Marc F Sorry:-) that is typo…Both sender and receiver using same multicast IP address as 239.255.0.20.

Marc F (guest) 19 Jun 2017 21:06
in discussion Hidden / Per page discussions » NORM Transport Notes

Maybe due to the mismatch in IP addresses used in the sender and receiver. The sender seems to be using .2, while the receiver connects to .20.

by Marc F (guest), 19 Jun 2017 21:06

ZeroMQ ( version - zeromq-4.1.6 & zeromq-4.2.1) PGM multicast packet receive stuck in between, even Sender still sending the packets without any issue.

If we restart the Receiver, application now receives the packets, but it won't be a solution. I tried with various ZMQ_RATE in both Sender & Receiver side.

Issue:

Sender sends almost 300,000 packets with following socket options, but Receiver stuck in between & not receiving all the packets.

Environment Setup:

( Sender & Receiver connected within the single subnet using D-Link switch. Media speed is 1Gbps )

Code Snippet

Sender: JZMQ ( ZMQ C library, openPGM )
JZMQ Sender:
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.PUB);
socket.setRate(80000);
socket.setRecoveryInterval(60*60);
socket.setSendTimeOut(-1);
socket.setSendBufferSize(1024*64);
socket.bind("pgm:
local_IP;239.255.0.20:30001");

byte[] bytesToSend = new byte[1024];
int count = 0;
while(count < 300000) {
socket.send(bytesToSend, 0);
count++;
}


//Receiver: ZMQ C++ ( ZMQ C library, openPGM )

// ZMQCPP-PGM-receive.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include "zmq.hpp"

int main(int argc, char* argv[]) {
try {

zmq::context_t context(1);

// Socket to talk to server
printf ("Connecting to server…");

zmq::socket_t *s1 = new zmq::socket_t(context, ZMQ_SUB);

int recvTimeout = 3000;
s1->setsockopt(ZMQ_RCVTIMEO,&recvTimeout,sizeof(int));

int recvRate = 80000;
s1->setsockopt(ZMQ_RATE,&recvRate,sizeof(int));

int recvHwMark = 5000;
s1->setsockopt ( ZMQ_RCVHWM, &recvHwMark, sizeof(int) );

int recsec = 60 * 60;
// s1->setsockopt(ZMQ_RECOVERY_IVL,&recsec,sizeof(recsec));

s1->connect("pgm://local_IP;239.255.0.20:30001");

s1->setsockopt (ZMQ_SUBSCRIBE, NULL, 0);

printf ("done. \n");
int seq=0;
while(true) {

zmq::message_t msgbuff;

int ret = s1->recv(&msgbuff,0);
if(!ret)
{
printf ("Received not received timeout\n");
continue;
}

printf ("Seq(%d) Received data size=%d\n",seq,msgbuff.size());
++seq;
}
//Socket close to be handled
}
catch( zmq::error_t &e ) {
printf ("An error occurred: %s\n", e.what());
return 1;
}
catch( std::exception &e ) {
printf ("An error occurred: %s\n", e.what());
return 1;
}
return 0;
}

What can be the issue?

Raju (guest) 14 Jun 2017 13:29
in discussion Hidden / Per page discussions » Broker vs. Brokerless

Busy for 6years.. !!!

by Raju (guest), 14 Jun 2017 13:29
hfcghfc
fresafresa 09 Jun 2017 11:45
in discussion Hidden / Per page discussions » cppzmq

hfcgfgf

hfcghfc by fresafresa, 09 Jun 2017 11:45

Hi all! Is it possible to send term command (Kill?) to connected peer, or how can i do that?

For example: DEALER (client) - ROUTER - DEALER (service), i need to connect clients with internal security policy… for example i need one client with identity "test", and dont accept other identity's. How to?

Hi,

I am planning to support "Reliable Multicast" for Bulk data transfer in my Desktop application by using ZMQ NORM_Engine. Before that i need clarification like "Is NORM require any network hardware dependency or NORM enabled router to make it as reliable transport apart from NORM based Sender & receiver.

If router doesn't support NORM or PGM protocol, Is it useful to integrate ZMQ PGM or ZMQ NORM library.

As from my analysis, PGM is transport layer protocol and it requires PGM enabled Transport layer in router devices. Also PGM supported only in cisco, Juniper network routers.

Please clarify.

page 1123...next »