All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zmq.socket.pubsub.Pub Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package zmq.socket.pubsub;

import zmq.Ctx;
import zmq.Msg;
import zmq.ZError;
import zmq.ZMQ;
import zmq.pipe.Pipe;

public class Pub extends XPub
{
    public Pub(Ctx parent, int tid, int sid)
    {
        super(parent, tid, sid);
        options.type = ZMQ.ZMQ_PUB;
    }

    @Override
    protected void xattachPipe(Pipe pipe, boolean subscribeToAll, boolean isLocallyInitiated)
    {
        assert (pipe != null);

        //  Don't delay pipe termination as there is no one
        //  to receive the delimiter.
        pipe.setNoDelay();

        super.xattachPipe(pipe, subscribeToAll, isLocallyInitiated);
    }

    @Override
    protected Msg xrecv()
    {
        errno.set(ZError.ENOTSUP);
        //  Messages cannot be received from PUB socket.
        throw new UnsupportedOperationException();
    }

    @Override
    protected boolean xhasIn()
    {
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy