<commit_before>#!/usr/bin/env python 
import os, sys, time, json
import requests
import logging

import pika

logging.basicConfig(level=logging.INFO, format='%(asctime)s | %(levelname)s | %(message)s')

RETRY_DELAY = 30000

TEST_NAME = 'test.queue_trigger_pattern'    
TEST_EXCHANGES = (('notify.retail.sale.Sale.updated',None),('notify.retail.sale.Sale.created',{'store':'Test Store 1'}))


def RequeableError( Exception ):
    pass
    
def FatalError( Exception ):
    pass

class QueueTriggerPattern():
   
    def __init__(self, microservice_name, exchanges, queue_host, queue_user, queue_pass):
        self.microservice_name = microservice_name
        self.exchanges = exchanges
        self.retry_ready_exchnage = 'microservice.' + microservice_name + '.retry_ready'
        self.retry_exchange = 'microservice.' + microservice_name + '.retry'
        self.queue_name = 'microservice.' + microservice_name
        self.retry_queue_name = 'microservice.' + microservice_name + ".retry"
    
        self.queue_host = queue_host
        self.queue_user = queue_user
        self.queue_pass = queue_pass
    
    
    def worker(self, message_json):
        print( "Should override worker and do something here" )
    
    
    def queue_callback(self, channel, method, properties, body):
        # Always ack before work has completed as we have assumed responsibility for message. Retry handled via new message passed to retry exchange
        try:
            channel.basic_ack(delivery_tag=method.delivery_tag, multiple=False)
            logging.info( "ackd" )
        except:
            logging.error( "Message unable to be ackd. Do not process now: %s"%body )
            raise

        try:<commit_msg>Inherit exceptions from base exception"<commit_after>#!/usr/bin/env python 
import os, sys, time, json
import requests
import logging

import pika

logging.basicConfig(level=logging.INFO, format='%(asctime)s | %(levelname)s | %(message)s')

RETRY_DELAY = 30000

TEST_NAME = 'test.queue_trigger_pattern'    
TEST_EXCHANGES = (('notify.retail.sale.Sale.updated',None),('notify.retail.sale.Sale.created',{'store':'Test Store 1'}))


class RequeableError( Exception ):
    pass
    
class FatalError( Exception ):
    pass

class QueueTriggerPattern():
   
    def __init__(self, microservice_name, exchanges, queue_host, queue_user, queue_pass):
        self.microservice_name = microservice_name
        self.exchanges = exchanges
        self.retry_ready_exchnage = 'microservice.' + microservice_name + '.retry_ready'
        self.retry_exchange = 'microservice.' + microservice_name + '.retry'
        self.queue_name = 'microservice.' + microservice_name
        self.retry_queue_name = 'microservice.' + microservice_name + ".retry"
    
        self.queue_host = queue_host
        self.queue_user = queue_user
        self.queue_pass = queue_pass
    
    
    def worker(self, message_json):
        print( "Should override worker and do something here" )
    
    
    def queue_callback(self, channel, method, properties, body):
        # Always ack before work has completed as we have assumed responsibility for message. Retry handled via new message passed to retry exchange
        try:
            channel.basic_ack(delivery_tag=method.delivery_tag, multiple=False)
            logging.info( "ackd" )
        except:
            logging.error( "Message unable to be ackd. Do not process now: %s"%body )
            raise

        try:
{'fraction_non_alphanumeric': 0.09786374133949191, 'fraction_numerical': 0.003464203233256351, 'mean_word_length': 3.1596638655462184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3130995', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1027, 'n_words': 253}