List of commits:
Subject Hash Author Date (UTC)
test case 2 fix(?) dd86d637d166707a31b644dad711c7a9e39dbc8d Jan Allersma 2017-11-04 10:55:03
Test case 2 9ea6eadbd85dde0e9522068718092b1f0e9b49f0 Jan Allersma 2017-10-29 22:37:57
Added threading. 4540fe1669c9e145e613edf2459031e7bec500ea Jan Allersma 2017-10-29 20:47:49
Code for testing 16/10/17. Use simulatie/rabbit/combination.py mainly. c5e87d7fe5abbcd3316b1538a0d647fd23faa59f Jan Allersma 2017-10-15 19:13:23
Added more paths. Some of them are WIP. 03ad1039e22bd1ebd301bda99e78f38239a15077 Jan Allersma 2017-09-21 14:40:44
Added paths... 5561d21918f048a40ca9686112638a48805917e3 Jan Allersma 2017-09-21 13:06:43
Added first paths of crossroad. Also added reference of crossroad. 43a5ddf291e38b47bad02a92af58839d86f9d449 Jan Allersma 2017-09-21 12:21:53
Added first paths of crossroad. Also added reference of crossroad. bb687a8152231d0c89fed827baefcfbf067be90c Jan Allersma 2017-09-21 12:21:11
Fixed typo. db82c84f8d834e62cb37333ff973ddc54af5372f Jan Allersma 2017-09-20 20:51:15
RabbitMQ test.First attempt. 876d29c668f5e027a820f3ff48a6ca080fc530c2 Jan Allersma 2017-09-19 13:47:31
Initial commit 6a565c61a3337232d0e7a136ffb2f49b431c2a40 Jan Allersma 2017-09-11 06:52:38
Commit dd86d637d166707a31b644dad711c7a9e39dbc8d - test case 2 fix(?)
Author: Jan Allersma
Author date (UTC): 2017-11-04 10:55
Committer name: Jan Allersma
Committer date (UTC): 2017-11-04 10:55
Parent(s): 9ea6eadbd85dde0e9522068718092b1f0e9b49f0
Signing key:
Tree: c893a7ce2e908de3563d9e8fc26b865e2bbbcff8
File Lines added Lines deleted
simulatie/rabbit/connection.py 9 16
simulatie/rabbit/model.py 3 3
simulatie/rabbit/test/connection.py 70 0
simulatie/rabbit/test/model.py 3 3
simulatie/rabbit/test/traffic.py 1 1
File simulatie/rabbit/connection.py changed (mode: 100644) (index 0ff3b76..edaf55a)
... ... import threading
5 5 creds = pika.PlainCredentials(model.uname, model.passwd) creds = pika.PlainCredentials(model.uname, model.passwd)
6 6 connection = pika.BlockingConnection(pika.ConnectionParameters(host=model.host, virtual_host=model.vhost, credentials=creds)) connection = pika.BlockingConnection(pika.ConnectionParameters(host=model.host, virtual_host=model.vhost, credentials=creds))
7 7 channel = connection.channel() channel = connection.channel()
8 recieve = connection.channel()
8 9
9 10 channel.exchange_declare( channel.exchange_declare(
10 11 exchange='1234', exchange='1234',
11 12 exchange_type='direct' exchange_type='direct'
12 13 ) )
13 14
14 result = channel.queue_declare(exclusive=True)
15 queuename = result.method.queue
16
17 channel.queue_bind(
18 exchange='1234',
19 queue=queuename,
20 routing_key=model.vhost
21 )
22
23 15 def callback(ch, method, prop, body): def callback(ch, method, prop, body):
24 print('%r ontvangen' % body)
16 print(model.recieveQueue + ': ')
17 print(body.decode('utf-8', 'ignore'))
25 18
26 channel.basic_consume (
19 recieve.basic_consume (
27 20 callback, callback,
28 queue=queuename,
21 queue=model.recieveQueue,
29 22 no_ack=True no_ack=True
30 23 ) )
31 24
32 25 def sendMsg(msg): def sendMsg(msg):
33 26 channel.basic_publish ( channel.basic_publish (
34 exchange='1234',
35 routing_key=model.vhost,
27 exchange='',
28 routing_key=model.sendQueue,
36 29 body=msg body=msg
37 30 ) )
38 31 print('Msg sent.') print('Msg sent.')
39
32
40 33 def listen(): def listen():
41 34 print('Waiting for a sign..') print('Waiting for a sign..')
42 channel.start_consuming()
35 recieve.start_consuming()
43 36
44 37 thread = threading.Thread(target=listen) thread = threading.Thread(target=listen)
45 38 thread.setDaemon(True) thread.setDaemon(True)
File simulatie/rabbit/model.py changed (mode: 100644) (index 1e18913..23f3004)
2 2 uname = 'softdev' uname = 'softdev'
3 3 passwd = 'softdev' passwd = 'softdev'
4 4 vhost = '/11' vhost = '/11'
5 host = '127.0.0.1'
5 host = '127.0.0.1'#'141.252.237.17'
6 6
7 c = 'controller'
8 s = 'simulator'
7 recieveQueue = 'controller'
8 sendQueue = 'simulator'
File simulatie/rabbit/test/connection.py added (mode: 100644) (index 0000000..72c16dd)
1 import pika
2 import model
3 import threading
4
5 creds = pika.PlainCredentials(model.uname, model.passwd)
6 connection = pika.BlockingConnection(pika.ConnectionParameters(host=model.host, virtual_host=model.vhost, credentials=creds))
7 channel = connection.channel()
8 recieve = connection.channel()
9
10 channel.exchange_declare(
11 exchange='1234',
12 exchange_type='direct'
13 )
14
15 def callback(ch, method, prop, body):
16 print(model.recieveQueue + ': ')
17 print(body.decode('utf-8', 'ignore'))
18
19 #recieve.queue_declare(
20 # queue=model.recieveQueue
21 #)
22
23 #channel.queue_declare(
24 # queue=model.sendQueue,
25 # auto_delete=True
26 #)
27
28 #result = channel.queue_declare(exclusive=True)
29 #queuename = result.method.queue
30
31 #channel.queue_bind(
32 # exchange='1234',
33 # queue='simulator',
34 # routing_key=model.vhost
35 #)
36
37 #recieve.queue_bind(
38 # exchange='1234',
39 # queue='controller',
40 # routing_key=model.vhost
41 #)
42
43 #channel.basic_consume (
44 # callback,
45 # queue=recieve,
46 # no_ack=True
47 #)
48
49 recieve.basic_consume (
50 callback,
51 queue=model.recieveQueue,
52 no_ack=True
53 )
54
55 def sendMsg(msg):
56 channel.basic_publish (
57 exchange='',
58 routing_key=model.sendQueue,
59 body=msg
60 )
61 print('Msg sent.')
62
63 def listen():
64 print('Waiting for a sign..')
65 recieve.start_consuming()
66
67 thread = threading.Thread(target=listen)
68 thread.setDaemon(True)
69 thread.start()
70 thread.join(0)
File simulatie/rabbit/test/model.py copied from file simulatie/rabbit/model.py (similarity 51%) (mode: 100644) (index 1e18913..2055742)
2 2 uname = 'softdev' uname = 'softdev'
3 3 passwd = 'softdev' passwd = 'softdev'
4 4 vhost = '/11' vhost = '/11'
5 host = '127.0.0.1'
5 host = '127.0.0.1'#'141.252.237.17'
6 6
7 c = 'controller'
8 s = 'simulator'
7 recieveQueue = 'simulator'
8 sendQueue = 'controller'
File simulatie/rabbit/test/traffic.py copied from file simulatie/rabbit/traffic.py (similarity 94%) (mode: 100644) (index 2fabb42..9437387)
... ... def update(index, amountOfCars, dirRequests):
17 17
18 18 msg = json.dumps({ msg = json.dumps({
19 19 "TrafficUpdate": { "TrafficUpdate": {
20 "LightId": lights[index][0],
20 "LightId": '500',
21 21 "Count": lights[index][1], "Count": lights[index][1],
22 22 "DirectionRequests": lights[index][2] "DirectionRequests": lights[index][2]
23 23 } }
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