- Notifications
You must be signed in to change notification settings - Fork 327
Issue 1562 routing key rabbitmq #1767
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
Merged
eyalkoren merged 12 commits into elastic:master from videnkz:issue-1562-routing-key-rabbitmq Oct 13, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits Select commit Hold shift + click to select a range
b0a04e3 added routingKey to message
videnkz 6479cbf minor fixes with capturing routingKey
videnkz 38c58d6 added entry to changelog
videnkz abc2c70 merge conflict resolved
videnkz bd67cdb merge conflict resolved
videnkz e2deb98 merge conflict resolved
videnkz 3105879 Merge remote-tracking branch 'upstream/master' into issue-1562-routin…
videnkz f4bb873 Merge remote-tracking branch 'upstream/master' into HEAD
eyalkoren 3de70c5 Fix CHANGELOG merge
eyalkoren 38eed7e Merge remote-tracking branch 'upstream/master' into issue-1562-routin…
videnkz c618d59 added routingKey to resetState and copyFrom. Added tests for this two…
videnkz 167246c moved serialization of routing_key before queue serialization.
videnkz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions 55 apm-agent-core/src/test/java/co/elastic/apm/agent/impl/context/MessageTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package co.elastic.apm.agent.impl.context; | ||
| | ||
| import org.junit.jupiter.api.Test; | ||
| | ||
| import java.util.Map; | ||
| | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| | ||
| class MessageTest { | ||
| | ||
| @Test | ||
| void testResetState() { | ||
| Message message = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); | ||
| | ||
| message.resetState(); | ||
| | ||
| assertThat(message.getAge()).isEqualTo(-1L); | ||
| assertThat(message.getQueueName()).isNull(); | ||
| assertThat(message.getRoutingKey()).isNull(); | ||
| assertThat(message.getHeaders()).isEmpty(); | ||
| assertThat(message.getBodyForRead()).isNull(); | ||
| } | ||
| | ||
| @Test | ||
| void testCopyFrom() { | ||
| Message firstMessage = createMessage(100L, "test-body", "test-q", "test-*", Map.of("test-header", "test-value")); | ||
| Message secondMessage = createMessage(999L, "updated-body", "updated-test-q", "updated-test-*", Map.of("updated-test-header", "updated-test-value")); | ||
| | ||
| firstMessage.copyFrom(secondMessage); | ||
| | ||
| assertThat(firstMessage.getAge()).isEqualTo(999L); | ||
| assertThat(firstMessage.getQueueName()).isEqualTo("updated-test-q"); | ||
| assertThat(firstMessage.getRoutingKey()).isEqualTo("updated-test-*"); | ||
| Headers firstMessageHeaders = firstMessage.getHeaders(); | ||
| assertThat(firstMessageHeaders.size()).isEqualTo(1); | ||
| Headers.Header firstMessageHeader = firstMessageHeaders.iterator().next(); | ||
| assertThat(firstMessageHeader.getKey()).isEqualTo("updated-test-header"); | ||
| assertThat(firstMessageHeader.getValue()).isEqualTo("updated-test-value"); | ||
| StringBuilder firstMessageBody = firstMessage.getBodyForRead(); | ||
| assertThat(firstMessageBody).isNotNull(); | ||
| assertThat(firstMessageBody.toString()).isEqualTo("updated-body"); | ||
| } | ||
| | ||
| private Message createMessage(long age, String body, String queue, String routingKey, Map<String, String> headers) { | ||
| Message message = new Message() | ||
| .withAge(age) | ||
| .withBody(body) | ||
| .withQueue(queue) | ||
| .withRoutingKey(routingKey); | ||
| for (Map.Entry<String, String> entry : headers.entrySet()) { | ||
| message.addHeader(entry.getKey(), entry.getValue()); | ||
| } | ||
| return message; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.