Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account_init_cleanup
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mitchell Moore
account_init_cleanup
Commits
a3fc9d30
Commit
a3fc9d30
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Fix connection parameters for cluster
parent
362c1f8d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
base_consumer.py
+8
-4
8 additions, 4 deletions
base_consumer.py
test_producer.py
+8
-2
8 additions, 2 deletions
test_producer.py
with
16 additions
and
6 deletions
base_consumer.py
+
8
−
4
View file @
a3fc9d30
#!/usr/bin/env python
#!/usr/bin/env python
import
pika
# python client
import
pika
# python client
import
sys
import
sys
connection
=
pika
.
BlockingConnection
(
credentials
=
pika
.
PlainCredentials
(
'
reggie
'
,
'
reggie
'
)
pika
.
ConnectionParameters
(
host
=
'
localhost
'
))
# connecting to a broker on the local machine
parameters
=
pika
.
ConnectionParameters
(
'
ood
'
,
5672
,
'
/
'
,
credentials
)
connection
=
pika
.
BlockingConnection
(
parameters
)
channel
=
connection
.
channel
()
channel
=
connection
.
channel
()
channel
.
exchange_declare
(
exchange
=
'
direct_logs
'
,
exchange_type
=
'
direct
'
)
# create exchange to pass messages
channel
.
exchange_declare
(
exchange
=
'
direct_logs
'
,
exchange_type
=
'
direct
'
)
# create exchange to pass messages
...
@@ -28,7 +33,6 @@ def callback(ch, method, properties, body):
...
@@ -28,7 +33,6 @@ def callback(ch, method, properties, body):
print
(
'
[%r] User creation task is done.
'
%
method
.
routing_key
)
print
(
'
[%r] User creation task is done.
'
%
method
.
routing_key
)
channel
.
basic_consume
(
channel
.
basic_consume
(
queue
=
queue_name
,
on_message_callback
=
callback
,
auto_ack
=
True
)
# ingest messages, and assume delivered via auto_ack
queue
=
queue_name
,
on_message_callback
=
callback
,
auto_ack
=
True
)
# ingest messages, and assume delivered via auto_ack
...
...
This diff is collapsed.
Click to expand it.
test_producer.py
+
8
−
2
View file @
a3fc9d30
...
@@ -2,8 +2,14 @@ import pika
...
@@ -2,8 +2,14 @@ import pika
import
sys
import
sys
# Begin RabbitMQ process.
# Begin RabbitMQ process.
connection
=
pika
.
BlockingConnection
(
credentials
=
pika
.
PlainCredentials
(
'
reggie
'
,
'
reggie
'
)
pika
.
ConnectionParameters
(
host
=
'
localhost
'
))
parameters
=
pika
.
ConnectionParameters
(
'
ood
'
,
5672
,
'
/
'
,
credentials
)
connection
=
pika
.
BlockingConnection
(
parameters
)
channel
=
connection
.
channel
()
channel
=
connection
.
channel
()
channel
.
exchange_declare
(
exchange
=
'
direct_logs
'
,
exchange_type
=
'
direct
'
)
channel
.
exchange_declare
(
exchange
=
'
direct_logs
'
,
exchange_type
=
'
direct
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment