When using XSUB to subscribe you need to call send prefixed with one byte
set to 1 and the subscription.
On Jun 18, 2016 23:04, "Klemen Živkovič" <[email protected]> wrote:
> I am trying to make XSUB socket subscribable so I could go around this
> IllegalArgumentException("subscription flag") I am getting in xsend method
> of XSub.class
>
> I tried using this to make socket subscribe - but somehow cannot do it:
>
> SocketBuilder builder = ctx.buildSocket(SocketType.XSUB)
> .asSubscribable()
> .subscribe("".getBytes());
> socket =builder.connect(this.halRCompUri);
>
> I get:
>
> Exception in thread "main" java.lang.ClassCastException:
> org.zeromq.jzmq.sockets.XSubSocketBuilder cannot be cast to
> org.zeromq.api.Subscribable
> at
> org.zeromq.jzmq.sockets.SocketBuilder.asSubscribable(SocketBuilder.java:294)
> at com.kz.pipeCutter.BBB.BBBHalRComp.getSocket(BBBHalRComp.java:150)
> at com.kz.pipeCutter.BBB.BBBHalRComp.<init>(BBBHalRComp.java:50)
> at com.kz.pipeCutter.BBB.BBBHalRComp.main(BBBHalRComp.java:183)
>
>
> Is it possible at all to send data from XSUB type socket?
>
> According to https://github.com/zeromq/rfc/blob/master/29/README.md it
> should be possible -
> "
> The XSUB Socket Type
> The XSUB socket type extends the SUB socket with the ability to send
> messages and subscription commands upstream to publishers
> "
>
> So any example how to do this through jzmq-api ?
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev