mirror of https://github.com/reiseburo/hermann
push method returns executing Promise
This commit is contained in:
parent
a08cfaa155
commit
3151b3ef4b
|
@ -37,7 +37,7 @@ module Hermann
|
||||||
# data to the kafka broker. Upon execution the Promise's status
|
# data to the kafka broker. Upon execution the Promise's status
|
||||||
# will be set
|
# will be set
|
||||||
def push_single(msg)
|
def push_single(msg)
|
||||||
Concurrent::Promise.new {
|
Concurrent::Promise.execute {
|
||||||
data = ProducerUtil::KeyedMessage.new(@topic, msg)
|
data = ProducerUtil::KeyedMessage.new(@topic, msg)
|
||||||
@producer.send(data)
|
@producer.send(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Hermann::Provider::JavaProducer do
|
||||||
context 'error conditions' do
|
context 'error conditions' do
|
||||||
shared_examples 'an error condition' do
|
shared_examples 'an error condition' do
|
||||||
it 'should be rejected' do
|
it 'should be rejected' do
|
||||||
promise = producer.push_single('rspec').execute.wait(1)
|
promise = producer.push_single('rspec').wait(1)
|
||||||
expect(promise).to be_rejected
|
expect(promise).to be_rejected
|
||||||
expect { promise.value! }.to raise_error
|
expect { promise.value! }.to raise_error
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue