stegemr commented on a change in pull request #372:
URL: https://github.com/apache/celix/pull/372#discussion_r725836608



##########
File path: bundles/cxx_remote_services/integration/src/CalculatorProvider.cc
##########
@@ -30,14 +31,57 @@ class CalculatorImpl final : public ICalculator {
     celix::Promise<double> add(double a, double b) override {
         auto deferred = factory->deferred<double>();
         deferred.resolve(a+b);
+
         return deferred.getPromise();
     }
 
+    void setPushStreamProvider(const 
std::shared_ptr<celix::PushStreamProvider>& provider) {
+        psp = provider;
+    }
+
     void setFactory(const std::shared_ptr<celix::PromiseFactory>& fac) {
         factory = fac;
     }
+
+    std::shared_ptr<celix::PushStream<double>> result() override {
+        return psp->createUnbufferedStream<double>(ses);
+    }
+
+    int init() {
+        return CELIX_SUCCESS;
+    }
+
+    int start() {
+        ses = psp->template createSynchronousEventSource<double>();
+
+        t = std::make_unique<std::thread>([&]() {
+            int counter = 0;
+            stopThread = false;
+            while(!stopThread) {
+                ses->publish((double)counter);
+                counter++;
+                std::this_thread::sleep_for(std::chrono::milliseconds{100});
+            }
+        });
+        return CELIX_SUCCESS;
+    }
+
+    int stop() {
+        stopThread = true;
+        t->join();
+        return CELIX_SUCCESS;
+    }
+
+    int deinit() {
+        return CELIX_SUCCESS;
+    }
+
 private:
+    std::unique_ptr<std::thread> t{};
     std::shared_ptr<celix::PromiseFactory> factory{};
+    std::shared_ptr<celix::PushStreamProvider> psp {};
+    std::shared_ptr<celix::SynchronousPushEventSource<double>> ses {};
+    volatile bool stopThread{false};

Review comment:
       yes done

##########
File path: 
bundles/cxx_remote_services/integration/src/TestExportImportRemoteServiceFactory.cc
##########
@@ -29,7 +31,7 @@
 #include "pubsub/publisher.h"
 #include "pubsub/subscriber.h"
 
-constexpr auto INVOKE_TIMEOUT = std::chrono::seconds{10};
+constexpr auto INVOKE_TIMEOUT = std::chrono::seconds{5}; //TODO make 
configurable

Review comment:
       removed the todo




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to