-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from RichardAF8/main
Tech Lab Collaborative Version
- Loading branch information
Showing
42 changed files
with
478 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Problem Definition: ✨Producer And Consumer✨ | ||
|
||
## Instructions | ||
|
||
In this section, you will collaborate with a partner to instantiate the producer and consumer classes. One person will focus on the producer section while the other works on the consumer section. Afterwards, you'll exchange solutions verbally or via GitHub. We highly recommend using GitHub for this purpose, working on the same fork, and pushing your solutions. GitHub is widely used across the tech industry. You can find a GitHub file in the resource folder to assist you with this. | ||
|
||
Below are bullet points of the criteria: | ||
- First ensure that each contributor is working from and has `cloned the same fork` of the BBIT-LEARNING-LABS repository. | ||
- Second ensure that each contributor has been `added as a collaborator to the fork.` | ||
- One person completes the `producer section.` | ||
- One person completes the `consumer section.` | ||
- Each contributor should then `git push` their solutions to the fork. | ||
- Lastly, follow the `testing instructions below` to send and recieve a message to complete this section. | ||
|
||
|
||
`IMPORTANT!!!` Please utlize the [Functions.md](../Resources/Functions.md) file as it contains almost all the functions you will need for this lab. Also, other helpful information can be found under the Resources folder for Python, Git, and RabbitMQ details. | ||
|
||
## Testing | ||
In order to verify that the consumer and producer class was properly instantiated, we will use the provided `consume.py`, and `publish.py` file from producer and consumer folder. Follow the below instructions: | ||
1. In the terminal window, run the `consume.py` file from the consumer sectio using the python interpreter. | ||
2. In another terminal window, run the `publish.py` file from the producer section using the python interpreter. This will publish a message using RabbitMQ. | ||
3. Return to the first terminal window with the consumer running. "Success! Producer And Consumer Section Complete." should now be displayed on your terminal if you instantiated & implemented the consumer class correctly. | ||
* Note that if you are developing from the terminal in your IDE, inside the second terminal window you will need to step into the rmq_lab Docker container in order to access the python enviroment. We do this by first running the `docker exec -it [containterName\containerID] /bin/bash` command. Using the `docker ps -a` command will show all the running docker containers and their associated I.D and names. Your command could be `docker exec -it tech-lab-on-campus-rmq_lab-1 /bin/bash` or `docker exec -it 8a785d10fd7e /bin/bash` | ||
|
36 changes: 36 additions & 0 deletions
36
Tech-Lab-On-Campus/Producer-And-Consumer/consumer/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Problem Definition: ✨Consumer✨ | ||
|
||
## Instructions | ||
Create a .py file that will contain a class that is setup to be a consumer in the RabbitMQ framework. This class will inherit from the mqConsumerInterface and consume and print a simple UTF-8 string message. | ||
|
||
Below are bullet points of the criteria: | ||
- In the `solution` directory, create a file named `consumer_sol.py` | ||
- Write your code in the `consumer_sol.py` file | ||
- Create a class named `mqConsumer` | ||
- Your class should inherit from our mqConsumerInterface. | ||
- Constructor: Save the three variables needed to instantiate the class. | ||
- Constructor: Call the setupRMQConnection function. | ||
- setupRMQConnection Function: Establish connection to the RabbitMQ service, declare a queue and exchange, bind the binding key to the queue on the exchange and finally set up a callback function for receiving messages | ||
- onMessageCallback: Print the UTF-8 string message and then close the connection. | ||
- startConsuming: Consumer should start listening for messages from the queue. | ||
|
||
|
||
## Testing | ||
In order to verify that the consumer class was properly instantiated, we will use the provided `consume.py`, file. Follow the below instructions: | ||
1. Start consumer | ||
* To test your implementation you can run `consume.py`. It will import your newly created class from the source file `consume_sol.py` in the `solution` directory. | ||
2. Log Into the RabbitMQ website. | ||
* The login URL for the management web application will be http://localhost:15672/ | ||
* Login username and password should be `guest` | ||
3. Check Queue | ||
* Click on tab `Queues and Streams`. | ||
* Under this tab you should see your created Queue appropriately named `Tech Lab Queue` | ||
|
||
![alt text](../../../data/Images/consumerQueue.jpeg) | ||
|
||
4. Check Binding | ||
* Click on the "Tech Lab Queue" | ||
* You should see under `Bindings` that the Queue is bound to the exchange `Tech Lab Exchange` with the key `Tech Lab Key` | ||
|
||
![alt text](../../../data/Images/consumerBinding.jpeg) | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.