Skip to content

Instantly share code, notes, and snippets.

@acidChrist
acidChrist / new_task.py
Created December 7, 2016 19:26 — forked from quiver/new_task.py
rabbitmq : dead letter exchange example with python/pika
#!/usr/bin/env python
# http://www.rabbitmq.com/tutorials/tutorial-two-python.html
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
message = ' '.join(sys.argv[1:]) or "Hello World!"
@anomit
anomit / app mailers queue_deliver_mailer.rb
Last active August 29, 2015 13:59
Hacking Rails mail delivery for an async solution with Sidekiq, Redis, Local Postfix SMTP server
class QueueDeliveryMailer < ActionMailer::Base
self.delivery_method = Rails.application.config.mail_queue_outbound_delivery_method #remember this from development.rb
layout nil
def rebuild_mail(id)
mail({:from => $redis.get("mail:#{id}:sender_address"),
:to => $redis.get("mail:#{id}:recipient_address"),
:reply_to => $redis.get("mail:#{id}:reply_to_address"),
:mime_version => $redis.get("mail:#{id}:mime_version"),
:content_type => $redis.get("mail:#{id}:content_type"),