-
Notifications
You must be signed in to change notification settings - Fork 3
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
[DNMY] Reworking #19
base: release/IPM-2.6.0
Are you sure you want to change the base?
[DNMY] Reworking #19
Conversation
amqp/src/AmqpClient.cpp
Outdated
//catch (const std::exception& e) { | ||
// logWarn("m_promiseReceiver error: {}", e.what()); | ||
//} | ||
//m_promiseReceiver.setValue(); |
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.
Remove it, this comment?
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.
I let this comment because if we wanted to restore the wait on a stop, we know that there is an issue ...
amqp/src/AmqpClient.cpp
Outdated
} | ||
|
||
bool AmqpClient::isConnected() { | ||
// Wait communication was restored | ||
// test if connected | ||
return (m_connection && m_connection.active() && connected() == ComState::Connected); | ||
} | ||
|
||
ComState AmqpClient::connected() | ||
{ | ||
//logTrace("AmqpClient::connected m_communicationState={}", m_communicationState); |
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.
remove it
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.
take into account
amqp/src/AmqpClient.h
Outdated
@@ -20,9 +20,10 @@ | |||
#pragma once | |||
|
|||
#include "MsgBusAmqpUtils.h" | |||
#include "../../utils/public_include/fty/messagebus2/utils/MsgBusPoolWorker.hpp" |
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 this and not "MsgBusPoolWorker.hpp" and in cmake add the right line?
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.
You are right, don't understand, it doesn't compile in my side ... I will try again
amqp/src/MessageBusAmqp.cpp
Outdated
return fty::unexpected(DeliveryState::Unavailable); | ||
} | ||
|
||
if (!m_clientPtr) { |
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.
This one can be factorized with isServiceAvailable(), isn't it?
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.
It has been made yet in AmqpClient
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.
I mean why do you test m_clientPtr after, if the test is done inside isServiceAvailable, the line 72 is redundant
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.
You are right, I change this
amqp/src/MessageBusAmqp.cpp
Outdated
logDebug("Sending message ..."); | ||
proton::message msgToSend = getAmqpMessage(message); | ||
|
||
if (!m_clientPtr) { |
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 like above
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.
It has been made yet in AmqpClient
} | ||
|
||
const std::string& MessageBusAmqp::clientName() const noexcept | ||
{ | ||
return m_busAmqp->clientName(); | ||
return m_clientName; |
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 did you remove the MsgBusAmqp, it's was a file (encapsulation) for fty, etn to check if the message was ok, or not, if a client want to bypass some part, he can call directly MessageBusAmqp.cpp (and h)
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.
I think that it complicate a little the code but the first reason that I wanted to have the same class for Promise in common. With this class, it would be impossible ...
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.
ok, but you remove this functionnality
common/src/Promise.cpp
Outdated
bool PromiseBase<T>::isReady() { | ||
bool res = false; | ||
if (m_future.valid()) { | ||
//auto r = m_future.wait_for(std::chrono::seconds(0)); |
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.
to remove
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.
Take into account
bool PromiseBase<T>::waitFor(const int& timeout_ms) { | ||
return ( | ||
isReady() && | ||
m_future.wait_for(std::chrono::duration<int,std::milli>(timeout_ms)) == std::future_status::ready |
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.
ident
void setValue(const Message& m); | ||
|
||
MessageBus& m_messageBus; // message bus instance | ||
std::string m_queue; // queue where the reply should arrive |
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.
Address insteafof m_queue (i.e. Address m_address);
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.
Take into account
common/src/Promise.cpp
Outdated
void Promise<Message>::setValue(const Message& m) { | ||
if (this->isReady()) { | ||
this->m_promise.set_value(m); | ||
//return {}; |
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.
to remove
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.
Just to remember that it is not possible in this case
void reset(); | ||
bool waitFor(const int& timeout_ms); | ||
|
||
public: |
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.
private
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.
Taken into account
//fty::Expected<void> setValue(const Message& m); | ||
void setValue(const Message& m); | ||
|
||
MessageBus& m_messageBus; // message bus instance |
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.
private members with accessors?
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.
Taken into account
|
||
template <typename T> | ||
PromiseBase<T>::PromiseBase() { | ||
m_future = m_promise.get_future(); |
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.
naming: getFuture?
Promise<Message>::~Promise() { | ||
if(!m_address.empty()) { | ||
m_messageBus.unreceive(m_address); | ||
m_address = ""; |
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 be: m_address.clear()
5075766
to
ba5ae6c
Compare
Remove connection error callback Remove auto accept for message
No description provided.