Skip to content

targoninc/lib-rabbitmq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This is a simple interface for sending tasks to RabbitMQ. It will serialize the task and send it to the specified exchange and queue. While getting tasks is generally implemented, it is not tested. If you intend to use it, feel free to contribute to this repo to improve it.

Example usage

Environment variables

Variable Description
RABBITMQ_HOST The host of the RabbitMQ instance
RABBITMQ_USER The user of the RabbitMQ instance
RABBITMQ_PASS The password of the RabbitMQ instance
<?php

use TargonIndustries\rabbitmq\tasks\MailTask;
use TargonIndustries\rabbitmq\TaskSender;

require_once './lib-rabbitmq/TaskSender.php';

$task = new MailTask('[email protected]', 'User', 'Your Subject here', 'This is an email.');
try {
    TaskSender::sendToRMQ($task->type, 'exchange', 'mail', $task);
} catch (Exception $e) {
    error_log("RabbitMQ error: " . $e->getMessage());
    return true;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages