mirror of https://github.com/reiseburo/hermann
Move to_java into java_producer to make push_single signature match MRI
This commit is contained in:
parent
e8703e1df4
commit
c29bb5e4d0
|
@ -63,8 +63,7 @@ module Hermann
|
|||
end
|
||||
|
||||
if Hermann.jruby?
|
||||
key = opts.has_key?(:partition_key) ? opts[:partition_key].to_java : nil
|
||||
result = @internal.push_single(value, topic, key, nil)
|
||||
result = @internal.push_single(value, topic, opts[:partition_key], nil)
|
||||
unless result.nil?
|
||||
@children << result
|
||||
end
|
||||
|
|
|
@ -44,6 +44,7 @@ module Hermann
|
|||
# data to the kafka broker. Upon execution the Promise's status
|
||||
# will be set
|
||||
def push_single(msg, topic, key, _)
|
||||
key = key && key.to_java
|
||||
Concurrent::Promise.execute {
|
||||
data = ProducerUtil::KeyedMessage.new(topic, nil, key, msg.to_java_bytes)
|
||||
begin
|
||||
|
|
|
@ -68,13 +68,7 @@ describe Hermann::Producer do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with explicit partition key', :platform => :java do
|
||||
it 'uses the partition key' do
|
||||
expect(producer.internal).to receive(:push_single).with(msg, topic, partition_key.to_java, anything)
|
||||
producer.push(msg, :partition_key => partition_key)
|
||||
end
|
||||
end
|
||||
context 'with explicit partition key', :platform => :mri do
|
||||
context 'with explicit partition key' do
|
||||
it 'uses the partition key' do
|
||||
expect(producer.internal).to receive(:push_single).with(msg, topic, partition_key, anything)
|
||||
producer.push(msg, :partition_key => partition_key)
|
||||
|
|
Loading…
Reference in New Issue