Skip to content
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

Merged
merged 33 commits into from
Oct 25, 2024

Conversation

HoussemNasri
Copy link
Member

@HoussemNasri HoussemNasri commented Oct 3, 2024

Fix #1163

Comment on lines 41 to 50
Boolean.TRUE.equals(channelPool.getChannelMono()
.map(channel -> {
try {
channel.queueDeclarePassive(QUEUE_NAME);
return true;
}
catch (IOException e) {
return false;
}
}).block());
Copy link
Member

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...

Copy link
Member

@quantranhong1999 quantranhong1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read it

.durable(DURABLE)),
sender.declareQueue(QueueSpecification
.queue(QUEUE_NAME)
.durable(evaluateDurable(DURABLE, commonRabbitMQConfiguration.isQuorumQueuesUsed()))),
Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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?

Comment on lines 98 to 102
Mono.just(messagePayload)
.map(message -> gson.fromJson(message, OpenPaasContactMessage.class))
.<ContactAddedRabbitMqMessage>handle((message, sink) -> {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how...

Copy link
Member

@chibenwa chibenwa left a 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)

@HoussemNasri HoussemNasri force-pushed the sync-openpaas-contact branch 2 times, most recently from 54c2718 to 4dbd165 Compare October 9, 2024 12:42
Comment on lines 346 to 353
/*
* 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() {
//
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

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.

Copy link
Member

@chibenwa chibenwa left a 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 ;-)

HoussemNasri and others added 8 commits October 22, 2024 15:32
…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]>
…agora/tmail/contact/OpenPaasContactsConsumerTest.java

Co-authored-by: Benoit TELLIER <[email protected]>
Copy link
Member

@chibenwa chibenwa left a 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

Copy link
Member

@quantranhong1999 quantranhong1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chibenwa chibenwa merged commit 40331b2 into linagora:master Oct 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tmail: Inject user contacts into auto-complete database
4 participants