[zeromq-dev] jeromq - java pojo zeromq

Min miniway at gmail.com
Wed Aug 22 15:08:12 CEST 2012


Hello,

If you don't set SUBSCRIBE, sub socket will block.

please add the following line before connect.

subscriber.subscribe("")      // please pull the latest source first

Thanks
Min

2012/8/22  <jonas.adler at epiq.se>:
> Hello!
>
> Let me first say that this is awesome, and I really love the amount of
> work you have put into this!
>
> However! I cannot get it to work on windows :(
>
> I try using this bit of code:
>
> public class TestZMQ {
>
>         public static void main(String[] args) {
>                 // Prepare our context and subscriber
>                 ZMQ.Context context = ZMQ.context(1);
>                 ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
>
>                 // Connect to server
>                 subscriber.connect("tcp://localhost:5563");
>                 while (true) {
>                         // Read envelope with address
>                         String address = new String(subscriber.recv(0));
>                         // Read message contents
>                         String contents = new String(subscriber.recv(0));
>                         System.out.println(address + " : " + contents);
>                 }
>         }
> }
>
> but the program hangs on subscriber.recv(0)!
>
> Following the call stack i see that the program gets stuck on:
>
> Signaler.wait_event(long) line:108
>
> which calls:
>
> WindowsSelectorImpl(SelectorImpl).selectNow()
>
> Anyone else has this issue? Or any idea on how to solve it? I have tried
> some debugging, and i know that on a TCP level, i am connected to the
> server...
>
>> Hello
>>
>> I'm happy to announce that I've built a jeromq with POJO based on
>> zeromq-3x c++ sources.
>>
>> https://github.com/miniway/jeromq
>>
>> The primary purpose of the work was to understand deeply how zeromq works.
>> I've got lots of insight and learned a lot from zeromq internals.
>>
>> It's in a very early stage and it must have bugs and issues. But I
>> hope this project help someone who only know java to understand
>> zeromq.
>>
>> Thanks
>> Min
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list