Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 81e45b9

Browse files
committed
Test round-trip of message attributes
1 parent 7c628e4 commit 81e45b9

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

spec/pulsar/client_spec.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,21 @@
4343

4444
it "can consume a single topic" do
4545
consumer = client.subscribe(topic, subscription_name)
46-
t = Thread.new { consumer.receive(timeout_ms).data }
47-
client.create_producer(topic).send("single")
48-
expect(t.join.value).to eq("single")
46+
t = Thread.new { consumer.receive(timeout_ms) }
47+
client.create_producer(topic).send("single",
48+
ordering_key: "order",
49+
partition_key: "a key",
50+
properties: {foo: "bar"})
51+
message = t.join.value
52+
53+
expect(message.data).to eq("single")
54+
55+
aggregate_failures "message attributes" do
56+
expect(message.ordering_key).to eq("order")
57+
expect(message.partition_key).to eq("a key")
58+
expect(message.properties).to eq({"foo" => "bar"})
59+
expect(message.properties["foo"]).to eq("bar")
60+
end
4961
end
5062

5163
it "can consume multiple topics" do

0 commit comments

Comments
 (0)