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.
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
|
|
||
| ComState AmqpClient::connected() | ||
| { | ||
| //logTrace("AmqpClient::connected m_communicationState={}", m_communicationState); |
amqp/src/AmqpClient.h
Outdated
| #pragma once | ||
|
|
||
| #include "MsgBusAmqpUtils.h" | ||
| #include "../../utils/public_include/fty/messagebus2/utils/MsgBusPoolWorker.hpp" |
There was a problem hiding this comment.
Why this and not "MsgBusPoolWorker.hpp" and in cmake add the right line?
There was a problem hiding this comment.
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.
This one can be factorized with isServiceAvailable(), isn't it?
There was a problem hiding this comment.
It has been made yet in AmqpClient
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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)); |
| 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 |
| 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.
Address insteafof m_queue (i.e. Address m_address);
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.
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.
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.
private members with accessors?
|
|
||
| template <typename T> | ||
| PromiseBase<T>::PromiseBase() { | ||
| m_future = m_promise.get_future(); |
There was a problem hiding this comment.
naming: getFuture?
| Promise<Message>::~Promise() { | ||
| if(!m_address.empty()) { | ||
| m_messageBus.unreceive(m_address); | ||
| m_address = ""; |
There was a problem hiding this comment.
could be: m_address.clear()
5075766 to
ba5ae6c
Compare
Remove connection error callback Remove auto accept for message
No description provided.