Apache Pulsar Docker - ubuntu
Run docker :
docker run -it \
-p 6650:6650 \
-p 8080:8080 \
-v $PWD/data:/pulsar/data \
apachepulsar/pulsar:2.4.1 \
bin/pulsar standalone
Download install pulsar-client
$ pip install pulsar-client
producer.py
------------
import pulsar
client = pulsar.Client('pulsar://localhost:6650')
producer = client.create_producer('my-topic')
for i in range(10):
producer.send(('hello-pulsar-%d' % i).encode('utf-8'))
client.close()
=> menjalankan : python producer.py
consumer.py
-----------
import pulsar
client = pulsar.Client('pulsar://localhost:6650')
consumer = client.subscribe('my-topic',
subscription_name='my-sub')
while True:
msg = consumer.receive()
print("Received message: '%s'" % msg.data())
consumer.acknowledge(msg)
client.close()
=> menjalankan : python consumer.py
Subscribe to:
Post Comments (Atom)
Pemrograman Running text P10 RGB dengan Arduino Nano
Pemrograman Running text P10 RGB dengan Arduino Nano PIN CONNECTION P10 RGB DENGAN ARDUINO NANO/UNO Source code arduino p10 RGB #include &q...
-
#include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> #include <Wire.h> // DS3231cl...
-
[Arduino] - Jam digital dan running text dengan LED Max7219 #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h...
-
Pemrograman Running text P10 RGB dengan Arduino Nano PIN CONNECTION P10 RGB DENGAN ARDUINO NANO/UNO Source code arduino p10 RGB #include &q...
No comments:
Post a Comment