/simulatie/sender.py (0b2e6e4c83b10f229a9d445c5877bd0bf53d5ec2) (1010 bytes) (mode 100644) (type blob)

#!/usr/bin/env python

import pika
#import threading
import model

creds = pika.PlainCredentials(model.uname, model.passwd)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=model.host, virtual_host=model.vhost, credentials=creds))
channel = connection.channel()

channel.queue_declare(
	queue=model.c,
	auto_delete=True
)

def start():
	channel.basic_consume(
		consumer_callback=cons_callb,
		queue=model.c
	);
	
	channel.start_consuming()

def cons_callb(self, channel, method, properties, body):
	content = body.decode('utf-8', 'ignore')
	print(content)

#channel.exchange_declare(
#	exchange='1234',
#	exchange_type='direct'
#)

	channel.basic_publish (
		exchange='',
		routing_key=model.vhost,
		properties=pika.BasicProperties(correlation_id=properties.correlation_id),
		body='Simulator ' + model.vhost
	)
	
	cannel.basic_ack(delivery_tag=method.delivery_tag)

	print('Ack sent.')

#connection.close()
start()
#thread = threading.Thread(target=start)
#thread.start()
#thread.join(0)


Mode Type Size Ref File
100644 blob 16 c6829d54ec4540d0a7ad29f662a2c128e0da945c .gitignore
040000 tree - f4d3a07b7699a8e327f9a2e932383f4a1275f7df Controller
100644 blob 565 39af52c077c0d4c3bc7730b362592e0bf7f635db README.md
040000 tree - 5b8609673ae5fd48f5f802caa4b13e426c72a644 jar
040000 tree - e1fc63bf64e8aed2ba3b27f543e337b20bf6ca91 simulatie
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-SoftDev

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-SoftDev

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-SoftDev

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main