# Path: gloss/subscribers/base_subscriber.py
# class BaseSubscriber(object):
#     log = Logger(namespace="subscription")
# 
#     def notify(self, msg, gloss_service):
#         raise NotImplementedError("this needs to be implemented")
# 
# Path: gloss/serialisers/opal.py
# def send_to_opal(message_container, end_point):
#     """ sends a message to an opal application
#     """
#     as_dict = message_container.to_dict()
#     response = requests.post(
#         end_point, json=json.dumps(as_dict, cls=OpalJSONSerialiser)
#     )
# 
#     if response.status_code > 300:
#         log = Logger(namespace="to_opal")
#         log.error(
#             "failed to send to elcid with {}".format(response.status_code)
#         )
# 
#     return
# 
# Path: gloss/models.py
# def atomic_method(some_fun):
#     def wrap_method(*args, **kwargs):
#         if "session" not in kwargs:
#             with session_scope() as session:
#                 kwargs["session"] = session
#                 result = some_fun(*args, **kwargs)
#         else:
#             result = some_fun(*args, **kwargs)
#         return result
# 
#     return wrap_method


from gloss.subscribers.base_subscriber import BaseSubscriber
from gloss.serialisers.opal import send_to_opal
from gloss.models import atomic_method


class SendAllMessages(BaseSubscriber):
    def __init__(self, *args, **kwargs):
        self.end_point = kwargs.pop("end_point")
        super(SendAllMessages, self).__init__(*args, **kwargs)


# Path: gloss/subscribers/base_subscriber.py
# class BaseSubscriber(object):
#     log = Logger(namespace="subscription")
# 
#     def notify(self, msg, gloss_service):
#         raise NotImplementedError("this needs to be implemented")
# 
# Path: gloss/serialisers/opal.py
# def send_to_opal(message_container, end_point):
#     """ sends a message to an opal application
#     """
#     as_dict = message_container.to_dict()
#     response = requests.post(
#         end_point, json=json.dumps(as_dict, cls=OpalJSONSerialiser)
#     )
# 
#     if response.status_code > 300:
#         log = Logger(namespace="to_opal")
#         log.error(
#             "failed to send to elcid with {}".format(response.status_code)
#         )
# 
#     return
# 
# Path: gloss/models.py
# def atomic_method(some_fun):
#     def wrap_method(*args, **kwargs):
#         if "session" not in kwargs:
#             with session_scope() as session:
#                 kwargs["session"] = session
#                 result = some_fun(*args, **kwargs)
#         else:
#             result = some_fun(*args, **kwargs)
#         return result
# 
#     return wrap_method


# Path: gloss/subscribers/send_all_messages.py
from gloss.subscribers.base_subscriber import BaseSubscriber
from gloss.serialisers.opal import send_to_opal
from gloss.models import atomic_method



class SendAllMessages(BaseSubscriber):
    def __init__(self, *args, **kwargs):
        self.end_point = kwargs.pop("end_point")
        super(SendAllMessages, self).__init__(*args, **kwargs)


    @atomic_method