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:

  • unsubscribe used to always return success when executed on event loop thread even if it failed

  • OnDisconnectCallback was 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 call OnResubscriptionCallback

  • Asynchronous 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_PAGES and FELIX_CLIENT_NETIO_PAGESIZE are ignored and taken from the bus

Initialization

  • Change FelixClientThread::Config to FelixClientThread::ConfigV2

  • Think about adding OnSubscriptionsLostCallback and OnResubscriptionCallback if you want to be notified when subscriptions are lost or automatically re-established

  • If you do not use asynchronous subscriptions/Initialization of connections think about removing OnConnectCallback and OnDisconnectCallback. They are not needed anymore.

  • If you use asynchronous subscriptions/Initialization of connections, think about adding OnConnectionRefusedCallback if 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 either init_send_data(uint64_t fid, std::chrono::milliseconds timeout) or init_send_data_nb(uint64_t fid)

  • Replace send_data(uint64_t fid, const uint8_t* data, size_t size, bool flush) and send_data_nb(uint64_t fid, const uint8_t* data, size_t size, bool flush) with send_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) and send_data_nb(netio_tag_t fid, const std::vector<const uint8_t*>& msgs, const std::vector<size_t>& sizes) with send_data(netio_tag_t fid, const std::vector<std::span<const uint8_t>>& msgs)

Subscription

  • Remove init_subscribe

  • Replace subscribe(uint64_t fid) with subscribe(std::uint64_t fid, std::chrono::milliseconds timeout) or subscribe_nb(std::uint64_t fid)

  • Replace subscribe(const std::vector<uint64_t>& fids) with subscribe(const std::vector<uint64_t>& fids, std::chrono::milliseconds timeout) or subscribe_nb(const std::vector<uint64_t>& fids)

  • Replace unsubscribe(uint64_t fid) with unsubscribe(std::uint64_t fid, std::chrono::milliseconds timeout) or unsubscribe_nb(std::uint64_t fid)

Timers

  • Replace start_timer(unsigned long interval) with start_timer(std::chrono::milliseconds interval)