Migration to 5.2.0
This section provides information how to migrate from the old (pre 5.2.0) to the new (5.2.0) API.
Caution
Only update your code if you no longer need to keep compatibility with the pre 5.2.0 releases.
Breaking changes
The old API is deprecated but still present in the 5.2.0 release. However, there are a few breaking changes compared to pre 5.2.0 releases:
unsubscribeused to always return success when executed on event loop thread even if it failedOnDisconnectCallbackwas not invoked for unsubscriptions (except if the connection was closed)Subscription callbacks would be invoked when request was sent without aknowledgement from server
Resubscriptions used to call
OnConnectCallback, now they callOnResubscriptionCallbackAsynchronous subscriptions would not be retried on
EAGAIN(and therefore never succeed)When calling subscribe asynchronously on the event loop thread, failure would result in all following FIDs to be dropped while reporting success
Synchronous subscriptions on the event loop thread would return timeout on first failure independent of timeout value (no retry)
FELIX_CLIENT_NETIO_PAGESandFELIX_CLIENT_NETIO_PAGESIZEare ignored and taken from the bus
Initialization
Change
FelixClientThread::ConfigtoFelixClientThread::ConfigV2Think about adding
OnSubscriptionsLostCallbackandOnResubscriptionCallbackif you want to be notified when subscriptions are lost or automatically re-establishedIf you do not use asynchronous subscriptions/Initialization of connections think about removing
OnConnectCallbackandOnDisconnectCallback. They are not needed anymore.If you use asynchronous subscriptions/Initialization of connections, think about adding
OnConnectionRefusedCallbackif you want to be notified about connection refusals.Remove the following properties from the configuration:
FELIX_CLIENT_LOG_LEVEL(replaced using environment variables to configure ERS)FELIX_CLIENT_TIMEOUT(not used by the new API)FELIX_CLIENT_NETIO_PAGES(taken from bus)FELIX_CLIENT_NETIO_PAGESIZE(taken from bus)
Sending Data
Replace
init_send_data(uint64_t fid)with eitherinit_send_data(uint64_t fid, std::chrono::milliseconds timeout)orinit_send_data_nb(uint64_t fid)Replace
send_data(uint64_t fid, const uint8_t* data, size_t size, bool flush)andsend_data_nb(uint64_t fid, const uint8_t* data, size_t size, bool flush)withsend_data(uint64_t fid, std::span<const uint8_t> data, bool flush)Replace
send_data(netio_tag_t fid, const std::vector<const uint8_t*>& msgs, const std::vector<size_t>& sizes)andsend_data_nb(netio_tag_t fid, const std::vector<const uint8_t*>& msgs, const std::vector<size_t>& sizes)withsend_data(netio_tag_t fid, const std::vector<std::span<const uint8_t>>& msgs)
Subscription
Remove
init_subscribeReplace
subscribe(uint64_t fid)withsubscribe(std::uint64_t fid, std::chrono::milliseconds timeout)orsubscribe_nb(std::uint64_t fid)Replace
subscribe(const std::vector<uint64_t>& fids)withsubscribe(const std::vector<uint64_t>& fids, std::chrono::milliseconds timeout)orsubscribe_nb(const std::vector<uint64_t>& fids)Replace
unsubscribe(uint64_t fid)withunsubscribe(std::uint64_t fid, std::chrono::milliseconds timeout)orunsubscribe_nb(std::uint64_t fid)
Timers
Replace
start_timer(unsigned long interval)withstart_timer(std::chrono::milliseconds interval)