Skip to content

ENH: add a camonitor -> kafka bridge#103

Draft
Thomas A Caswell (tacaswell) wants to merge 1 commit intoNSLS2:mainfrom
tacaswell:epics2kafka
Draft

ENH: add a camonitor -> kafka bridge#103
Thomas A Caswell (tacaswell) wants to merge 1 commit intoNSLS2:mainfrom
tacaswell:epics2kafka

Conversation

@tacaswell
Copy link
Copy Markdown
Contributor

This is a mass-up of caproto-monitor and the guts of KafkaPublisher.

To read the values back out:

from functools import partial
from confluent_kafka import Consumer
import msgpack
import msgpack_numpy as mpn


consumer_config = {
    "bootstrap.servers": "127.0.0.1:9092",
    "group.id": "kafka-unit-test-group-id",
    "auto.offset.reset": "latest",
}


deserializer = partial(msgpack.loads, object_hook=mpn.decode)

consumer = Consumer(consumer_config)
consumer.subscribe(["demo"])

while True:
    msg = consumer.poll(1)

    if msg is None:
        # no message was delivered
        # do some work before polling again
        time.sleep(0.1)
    else:
        payload = deserializer(msg.value())
        print(payload)

Not really sure where to send this (bluesky-pods? caproto?), settled on here but happy to move.

@codecov-commenter
Copy link
Copy Markdown

Codecov Comments Bot (codecov-commenter) commented Aug 28, 2020

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.17%. Comparing base (18c0632) to head (8122ee7).
⚠️ Report is 593 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
+ Coverage   56.61%   57.17%   +0.56%     
==========================================
  Files          13       13              
  Lines         892      892              
==========================================
+ Hits          505      510       +5     
+ Misses        387      382       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants