diff --git a/examples/consumer.cpp b/examples/consumer.cpp
new file mode 100644
index 0000000..8a83574
--- /dev/null
+++ b/examples/consumer.cpp
@@ -0,0 +1,115 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis
+ *
+ * This file is part of PSync.
+ * See AUTHORS.md for complete list of PSync authors and contributors.
+ *
+ * PSync is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * PSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include <PSync/consumer.hpp>
+
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/util/logger.hpp>
+#include <ndn-cxx/util/random.hpp>
+
+#include <iostream>
+
+NDN_LOG_INIT(examples.PartialSyncConsumerApp);
+
+class PSyncConsumer
+{
+public:
+  /**
+   * @brief Initialize consumer and start hello process
+   *
+   * 0.001 is the false positive probability of the bloom filter
+   *
+   * @param syncPrefix should be the same as producer
+   * @param nSub number of subscriptions is used for the bloom filter (subscription list) size
+   */
+  PSyncConsumer(const ndn::Name& syncPrefix, int nSub)
+    : m_nSub(nSub)
+    , m_consumer(syncPrefix, m_face,
+                 std::bind(&PSyncConsumer::afterReceiveHelloData, this, _1),
+                 std::bind(&PSyncConsumer::processSyncUpdate, this, _1),
+                 m_nSub, 0.001)
+    , m_rng(ndn::random::getRandomNumberEngine())
+  {
+    // This starts the consumer side by sending a hello interest to the producer
+    // When the producer responds with hello data, afterReceiveHelloData is called
+    m_consumer.sendHelloInterest();
+  }
+
+  void
+  run()
+  {
+    m_face.processEvents();
+  }
+
+private:
+  void
+  afterReceiveHelloData(const std::vector<ndn::Name>& availSubs)
+  {
+    // Randomly subscribe to m_nSub prefixes
+    std::vector<ndn::Name> sensors = availSubs;
+
+    std::shuffle(sensors.begin(), sensors.end(), m_rng);
+
+    for (int i = 0; i < m_nSub; i++) {
+      NDN_LOG_INFO("Subscribing to: " << sensors[i]);
+      m_consumer.addSubscription(sensors[i]);
+    }
+
+    // After setting the subscription list, send the sync interest
+    // The sync interest contains the subscription list
+    // When new data is received for any subscribed prefix, processSyncUpdate is called
+    m_consumer.sendSyncInterest();
+  }
+
+  void
+  processSyncUpdate(const std::vector<psync::MissingDataInfo>& updates)
+  {
+    for (const auto& update : updates) {
+      for (uint64_t i = update.lowSeq; i <= update.highSeq; i++) {
+        // Data can now be fetched using the prefix and sequence
+        NDN_LOG_INFO("Update: " << update.prefix << "/" << i);
+      }
+    }
+  }
+
+private:
+  ndn::Face m_face;
+  int m_nSub;
+
+  psync::Consumer m_consumer;
+  ndn::random::RandomNumberEngine& m_rng;
+};
+
+int
+main(int argc, char* argv[])
+{
+  if (argc != 3) {
+    std::cout << "usage: " << argv[0] << " "
+              << "<sync-prefix> <number-of-subscriptions>" << std::endl;
+    return 1;
+  }
+
+  try {
+    PSyncConsumer consumer(argv[1], std::stoi(argv[2]));
+    consumer.run();
+  }
+  catch (const std::exception& e) {
+    NDN_LOG_ERROR(e.what());
+  }
+}
