-
Notifications
You must be signed in to change notification settings - Fork 47
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
Support exchange properties #646
Support exchange properties #646
Conversation
0dba887
to
848f740
Compare
@gaoran10 @codelipenghui PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Left some comments.
case EXCHANGE: | ||
map.put(k, ExchangeUtil.covertStringValueAsObject(v, String.class)); | ||
break; | ||
case INDEX: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need this?
@@ -44,11 +44,20 @@ public class InMemoryExchange extends AbstractAmqpExchange { | |||
private final long currentLedgerId; | |||
private long currentEntryId; | |||
|
|||
private Map<String, Object> properties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add this field in class AbstractAmqpExchange
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PersistentExchange
don't need this field.
properties.forEach((k, v) -> { | ||
switch (k) { | ||
case QUEUES: | ||
map.put(k, ExchangeUtil.covertStringValueAsObject(v, List.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The QUEUES
is not a custom property.
map.put(k, ExchangeUtil.covertStringValueAsObject(v, List.class)); | ||
break; | ||
case TYPE: | ||
case EXCHANGE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with QUEUES
.
CompletableFuture<Topic> topicCompletableFuture = amqpTopicManager.getTopic(topicName, createIfMissing); | ||
|
||
Map<String, String> newProperties = null; | ||
if (createIfMissing && arguments != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can serialize declare custom properties to a JSON string, and put it to a specific key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
@@ -57,7 +68,8 @@ protected ExchangeContainer(AmqpTopicManager amqpTopicManager, PulsarService pul | |||
public CompletableFuture<AmqpExchange> asyncGetExchange(NamespaceName namespaceName, | |||
String exchangeName, | |||
boolean createIfMissing, | |||
String exchangeType) { | |||
String exchangeType, | |||
FieldTable arguments) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we change this to Map<String, Object>
?
a5575c5
to
172ecc2
Compare
2. add declare check for durable, autoDelete
…o init PersistentExchange.
props.put(DURABLE, "" + durable); | ||
props.put(AUTO_DELETE, "" + autoDelete); | ||
props.put(INTERNAL, "" + internal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
props.put(DURABLE, "" + durable); | |
props.put(AUTO_DELETE, "" + autoDelete); | |
props.put(INTERNAL, "" + internal); | |
props.put(DURABLE, Double.toString(durable)); | |
props.put(AUTO_DELETE, Double.toString(autoDelete)); | |
props.put(INTERNAL, Double.toString(internal)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'll resolve this in another PR.
Master Issue: #631
Motivation
Support exchange properties
Modifications
Save durable, auto-delete to exchange properties.
Add exchange declare check for the durable and auto-delete parameter.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below.
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)