spec/integration/concurrency_spec.rb in freddy-jruby-0.4.9 vs spec/integration/concurrency_spec.rb in freddy-jruby-0.5.0

- old
+ new

@@ -82,6 +82,28 @@ end end.map(&:join) expect(results.count).to eq(10) end + + context 'concurrent executions of deliver_with_response' do + let(:nr_of_threads) { 50 } + let(:payload) { {pay: 'load'} } + let(:msg_counter) { Hamster.mutable_set } + let(:queue_name) { random_destination } + + before do + spawn_echo_responder(freddy1, queue_name) + end + + it 'is supported' do + nr_of_threads.times.map do |index| + Thread.new do + response = freddy1.deliver_with_response(queue_name, payload) + msg_counter << index + expect(response).to eq(payload) + end + end.each(&:join) + expect(msg_counter.count).to eq(nr_of_threads) + end + end end