-
Notifications
You must be signed in to change notification settings - Fork 22
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
[ISSUE-1163] Inject OpenPaaS user contacts into Tmail's auto-complete database #1215
[ISSUE-1163] Inject OpenPaaS user contacts into Tmail's auto-complete database #1215
Conversation
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
Boolean.TRUE.equals(channelPool.getChannelMono() | ||
.map(channel -> { | ||
try { | ||
channel.queueDeclarePassive(QUEUE_NAME); | ||
return true; | ||
} | ||
catch (IOException e) { | ||
return false; | ||
} | ||
}).block()); |
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.
That's a VERY good finding, I wasn't aware of this methods.
So if the queue already exist but with slightly different arguments does it throws? Can you please quickly test that? If no, then we have a solution to our major RabbitMQ migration nightmares Cc @QuangHoang1210 @Arsnael @vttranlina and we could use it more widely in the source code...
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.../src/main/scala/com/linagora/tmail/james/jmap/contact/openpaas/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
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.
Read it
f4a2edd
to
9984af3
Compare
...nsions/src/test/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumerTest.java
Outdated
Show resolved
Hide resolved
...nsions/src/test/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumerTest.java
Outdated
Show resolved
Hide resolved
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
.durable(DURABLE)), | ||
sender.declareQueue(QueueSpecification | ||
.queue(QUEUE_NAME) | ||
.durable(evaluateDurable(DURABLE, commonRabbitMQConfiguration.isQuorumQueuesUsed()))), |
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.
Queue MUST always be durable.
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.
And ideally queue settings shall be obtained from commonRabbitMQConfiguration
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.
There isn't any isDurable() method in commonRabbitMQConfiguration, should I add one?
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...p/extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactMessage.java
Outdated
Show resolved
Hide resolved
.../extensions/src/main/java/com/linagora/tmail/james/jmap/contact/jCardObjectDeserializer.java
Outdated
Show resolved
Hide resolved
.../extensions/src/main/java/com/linagora/tmail/james/jmap/contact/jCardObjectDeserializer.java
Outdated
Show resolved
Hide resolved
.../extensions/src/main/java/com/linagora/tmail/james/jmap/contact/jCardObjectDeserializer.java
Outdated
Show resolved
Hide resolved
...backend/jmap/extensions/src/main/java/com/linagora/tmail/james/jmap/contact/jCardObject.java
Outdated
Show resolved
Hide resolved
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
Mono.just(messagePayload) | ||
.map(message -> gson.fromJson(message, OpenPaasContactMessage.class)) | ||
.<ContactAddedRabbitMqMessage>handle((message, sink) -> { |
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.
We likely do not need that "just" and can inline the reactor transformations.
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.
Not sure how...
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...nsions/src/test/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumerTest.java
Outdated
Show resolved
Hide resolved
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...d/jmap/extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasWebClient.java
Outdated
Show resolved
Hide resolved
74dfe12
to
7f43080
Compare
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.
Cool but IMO we would deserve to have dedicated tests for OpenPaaSWebClient
class.
(Test in isolation for this)
...d/jmap/extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasWebClient.java
Outdated
Show resolved
Hide resolved
54c2718
to
4dbd165
Compare
...extensions/src/main/java/com/linagora/tmail/james/jmap/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
2a0a5b2
to
7bd2df7
Compare
...ird-party/openpaas/src/main/java/com/linagora/tmail/contact/ContactAddedRabbitMqMessage.java
Outdated
Show resolved
Hide resolved
...-third-party/openpaas/src/main/java/com/linagora/tmail/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...-third-party/openpaas/src/main/java/com/linagora/tmail/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...-third-party/openpaas/src/main/java/com/linagora/tmail/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...end/tmail-third-party/openpaas/src/test/java/com/linagora/tmail/contact/JCardObjectTest.java
Outdated
Show resolved
Hide resolved
...rd-party/openpaas/src/test/java/com/linagora/tmail/contact/OpenPaasContactsConsumerTest.java
Outdated
Show resolved
Hide resolved
/* | ||
* The automatic contact indexing is triggered when you send or receive a message | ||
* from someone, then their contact info be automatically indexed in the contacts' search engine. | ||
* */ | ||
@Test | ||
void automaticContactIndexingShouldNotOverrideContactInfoFromOpenPaas() { | ||
// | ||
} |
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.
?
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.
Now that we have defined the expected behavior. i.e. OpenPaas is the single source of truth for contacts, this test case become irrelevant.
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.
We are getting closer ;-)
...-third-party/openpaas/src/main/java/com/linagora/tmail/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
...-third-party/openpaas/src/main/java/com/linagora/tmail/contact/OpenPaasContactsConsumer.java
Outdated
Show resolved
Hide resolved
…agora/tmail/contact/OpenPaasContactsConsumer.java Co-authored-by: Benoit TELLIER <[email protected]>
…agora/tmail/contact/JCardObjectTest.java Co-authored-by: Benoit TELLIER <[email protected]>
…agora/tmail/contact/OpenPaasContactsConsumer.java Co-authored-by: Benoit TELLIER <[email protected]>
…agora/tmail/contact/OpenPaasContactsConsumerTest.java Co-authored-by: Benoit TELLIER <[email protected]>
…agora/tmail/contact/ContactAddedRabbitMqMessage.java Co-authored-by: Benoit TELLIER <[email protected]>
...rd-party/openpaas/src/test/java/com/linagora/tmail/contact/OpenPaasContactsConsumerTest.java
Outdated
Show resolved
Hide resolved
…agora/tmail/contact/OpenPaasContactsConsumerTest.java Co-authored-by: Benoit TELLIER <[email protected]>
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.
Should be more or less good to me
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.
LGTM
Fix #1163