All Projects → mazingstudio → hop

mazingstudio / hop

Licence: MIT license
An AMQP client wrapper that provides easy work queue semantics

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to hop

Machinery
Machinery is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 5,821 (+27619.05%)
Mutual labels:  queue, amqp
Yii2 Async
Provides translucent api & queues for moving large tasks out of request context with SQL, Redis or AMQP.
Stars: ✭ 64 (+204.76%)
Mutual labels:  queue, amqp
Node Celery
Celery client for Node.js
Stars: ✭ 648 (+2985.71%)
Mutual labels:  queue, amqp
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+4552.38%)
Mutual labels:  queue, amqp
Garagemq
AMQP message broker implemented with golang
Stars: ✭ 153 (+628.57%)
Mutual labels:  queue, amqp
celery.node
Celery task queue client/worker for nodejs
Stars: ✭ 164 (+680.95%)
Mutual labels:  queue, amqp
Yii Queue
Queue extension for Yii 3.0
Stars: ✭ 38 (+80.95%)
Mutual labels:  queue, amqp
azure-service-bus-go
Golang library for Azure Service Bus -- https://aka.ms/azsb
Stars: ✭ 67 (+219.05%)
Mutual labels:  queue, amqp
Amqp Tools
The amqp tools such as delay strategies and so on.
Stars: ✭ 125 (+495.24%)
Mutual labels:  queue, amqp
Amqp Interop
PHP 7.1+. Promoting the interoperability of AMQPs. It is based on queue-interop
Stars: ✭ 124 (+490.48%)
Mutual labels:  queue, amqp
gobroker
golang wrapper for all (to-be) kinds of message brokers
Stars: ✭ 15 (-28.57%)
Mutual labels:  queue, amqp
dispatcher
Dispatcher is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 60 (+185.71%)
Mutual labels:  queue, amqp
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+5495.24%)
Mutual labels:  queue, amqp
Laravel Queue
Laravel Enqueue message queue extension. Supports AMQP, Amazon SQS, Kafka, Google PubSub, Redis, STOMP, Gearman, Beanstalk and others
Stars: ✭ 155 (+638.1%)
Mutual labels:  queue, amqp
jobs
RoadRunner: Background PHP workers, Queue brokers
Stars: ✭ 59 (+180.95%)
Mutual labels:  queue, amqp
filequeue
light weight, high performance, simple, reliable and persistent queue for Java applications
Stars: ✭ 35 (+66.67%)
Mutual labels:  queue
gostalkd
sjis.me
Stars: ✭ 18 (-14.29%)
Mutual labels:  queue
conejo
Conejo is a library based on pma/amqp which will help you to define your AMQP/RabbitMQ publishers and consumers in an easier way.
Stars: ✭ 14 (-33.33%)
Mutual labels:  amqp
theeye-of-sauron
TheEye Dockers and QuickStart
Stars: ✭ 27 (+28.57%)
Mutual labels:  queue
needle
📌📚 An extensive standalone data structure library for JavaScript.
Stars: ✭ 25 (+19.05%)
Mutual labels:  queue

Hop

GoDoc Go Report Card license

An AMQP client wrapper that provides easy work queue semantics

Introduction

Hop consists of a simple set of abstractions over AMQP concepts that allow you to think in terms of jobs and topics, rather than queues, exchanges and routing.

Jobs

The most basic abstraction in Hop are Jobs, which are work units that may be marked as done or failed by your worker processes. When a Job is completed succesfully, it gets removed from the queue. If a Job fails, on the other hand, the worker has the option of requeueing it or dropping it altogether. If a worker dies in the middle of processing a Job, the Job is placed back into the queue. All of this maps to AMQP messages and ack and reject mechanics.

Topics

Similarly to the beanstalkd concept of tubes, Hop introduces Topics, which are distinct queues into which producers can put work units, and from which workers can pull them for processing. Underneath, a Topic is a mapping to an AMQP TCP channel, and a queue with the same name as the Topic. Note that Topics are not the same as AMQP exchange topics.

The Work Queue

The third Hop abstraction is the Work Queue, which is nothing more than the grouping of Topics a worker or producer can interact with. The Work Queue abtracts over the TCP connection to the AMQP broker and performs such tasks as dialing, graceful shutdown, and declaration of new channels. Underneath, it maps to an AMQP direct exchange.

Usage

package main

import (
	log "github.com/Sirupsen/logrus"
	"github.com/mazingstudio/hop"
)

func main() {
	// Initialize a WorkQueue with the default configuration
	wq, err := hop.DefaultQueue("amqp://guest:guest@localhost:5672/")
	if err != nil {
		log.Fatalf("error creating queue: %s", err)
	}
	// Make sure to gracefully shut down
	defer wq.Close()

	// Get the "tasks" Topic handle
	tasks, err := wq.GetTopic("tasks")
	if err != nil {
		log.Fatalf("error getting topic: %s", err)
	}

	// Put a Job into the "tasks" Topic
	err = tasks.Put([]byte("Hello"))
	if err != nil {
		log.Fatalf("error putting: %s", err)
	}

	// Pull the Job from the Topic
	hello, err := tasks.Pull()
	if err != nil {
		log.Fatalf("error pulling: %s", err)
	}
	// This should print "hello"
	log.Infof("job body: %s", hello.Body())

	// Mark the Job as failed and requeue
	hello.Fail(true)

	// Pull the Job again
	hello2, err := tasks.Pull()
	if err != nil {
		log.Fatalf("error pulling: %s", err)
	}
	log.Infof("job body: %s", hello.Body())

	// Mark the Job as done
	hello2.Done()
}

License & Third Party Code

Hop uses streadway/amqp internally.

Hop is distributed under the MIT License. Please refer to LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].