Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consuming with snappy only receives one message #1

Open
robseed opened this issue Aug 6, 2015 · 2 comments
Open

Consuming with snappy only receives one message #1

robseed opened this issue Aug 6, 2015 · 2 comments

Comments

@robseed
Copy link

robseed commented Aug 6, 2015

            //curl -d 'message 1' 'http://localhost:4151/put?topic=test_snappy'
            //curl -d 'message 2' 'http://localhost:4151/put?topic=test_snappy'
            //curl -d 'message 3' 'http://localhost:4151/put?topic=test_snappy'

            NSQLookup lookup = new DefaultNSQLookup();
            lookup.addLookupAddress("localhost", 4161);
            NSQConfig config = new NSQConfig();
            config.setCompression(NSQConfig.Compression.SNAPPY);
            NSQConsumer consumer = new NSQConsumer(lookup, "test_snappy", "test_consume",
                    (msg) -> {
                        System.out.println(new String(msg.getMessage()));
                        msg.finished();
                    }, config);
            consumer.start();
            Thread.sleep(20000);
            System.out.println("done");

10:10:01.997 INFO  Created connection: Rob-Seeds-MacBook-Pro.local:4150 - Connection.<init> 
10:10:02.021 INFO  IdentifyResponse: {"max_rdy_count":2500,"version":"0.3.2","max_msg_timeout":900000,"msg_timeout":60000,"tls_v1":false,"deflate":false,"deflate_level":0,"max_deflate_level":6,"snappy":true,"sample_rate":0,"auth_required":false,"output_buffer_size":16384,"output_buffer_timeout":250} - NSQFeatureDetectionHandler.channelRead0 
10:10:02.025 INFO  Adding snappy to pipline - NSQFeatureDetectionHandler.installSnappyDecoder 
10:10:02.027 INFO  IdentifyResponse: OK - NSQFeatureDetectionHandler.channelRead0 
10:10:02.029 INFO  Server identification: {"max_rdy_count":2500,"version":"0.3.2","max_msg_timeout":900000,"msg_timeout":60000,"tls_v1":false,"deflate":false,"deflate_level":0,"max_deflate_level":6,"snappy":true,"sample_rate":0,"auth_required":false,"output_buffer_size":16384,"output_buffer_timeout":250} - Connection.<init> 
message 1
done

Works as expected when not using snappy compression. Publishing with snappy enabled works fine.

@brainlag
Copy link
Owner

brainlag commented Aug 7, 2015

I can reproduce this, looking into it.

@brainlag
Copy link
Owner

After playing around a bit the problem seems to be that the messages are too small.
So the server basically waits to get enough data that compress actually has an effect.

There is also this bug: nsqio/nsq#532

aldemirenes added a commit to aldemirenes/JavaNSQClient that referenced this issue Aug 28, 2017
aldemirenes added a commit to aldemirenes/JavaNSQClient that referenced this issue Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants