예제 #1
0
    def _init(self):
        """ Actually initializes the service.
        """
        self.odb = self.worker_store.server.odb
        self.kvdb = self.worker_store.kvdb
        self.time.kvdb = self.kvdb
        self.pubsub = self.worker_store.pubsub

        self.slow_threshold = self.server.service_store.services[
            self.impl_name]['slow_threshold']

        # Queues
        out_amqp = PublisherFacade(self.broker_client)
        out_jms_wmq = WMQFacade(self.broker_client)
        out_zmq = ZMQFacade(self.server)

        # Patterns
        self.patterns = PatternsFacade(self)

        # SQL
        out_sql = self.worker_store.sql_pool_store

        # Regular outconns
        out_ftp, out_odoo, out_plain_http, out_soap = self.worker_store.worker_config.outgoing_connections(
        )
        self.outgoing = Outgoing(out_amqp, out_ftp, out_jms_wmq, out_odoo,
                                 out_plain_http, out_soap, out_sql,
                                 self.worker_store.stomp_outconn_api, out_zmq)

        # Cloud
        self.cloud = Cloud()
        self.cloud.openstack.swift = self.worker_store.worker_config.cloud_openstack_swift
        self.cloud.aws.s3 = self.worker_store.worker_config.cloud_aws_s3

        # Cassandra
        self.cassandra_conn = self.worker_store.cassandra_api
        self.cassandra_query = self.worker_store.cassandra_query_api

        # E-mail
        self.email = EMailAPI(self.worker_store.email_smtp_api,
                              self.worker_store.email_imap_api)

        # Search
        self.search = SearchAPI(self.worker_store.search_es_api,
                                self.worker_store.search_solr_api)

        is_sio = hasattr(self, 'SimpleIO')
        self.request.http.init(self.wsgi_environ)

        if is_sio:
            self.request.init(is_sio, self.cid, self.SimpleIO,
                              self.data_format, self.transport,
                              self.wsgi_environ)
            self.response.init(self.cid, self.SimpleIO, self.data_format)

        self.msg = MessageFacade(self.worker_store.msg_ns_store,
                                 self.worker_store.json_pointer_store,
                                 self.worker_store.xpath_store,
                                 self.worker_store.msg_ns_store,
                                 self.request.payload, self.time)
예제 #2
0
파일: __init__.py 프로젝트: ccjchina/zato
    def _init(self):
        """ Actually initializes the service.
        """
        self.odb = self.worker_store.server.odb
        self.kvdb = self.worker_store.kvdb
        self.time.kvdb = self.kvdb

        self.slow_threshold = self.server.service_store.services[self.impl_name]['slow_threshold']

        out_amqp = PublisherFacade(self.broker_client, self.server.delivery_store)
        out_jms_wmq = WMQFacade(self.broker_client, self.server.delivery_store)
        out_zmq = ZMQFacade(self.broker_client, self.server.delivery_store)
        out_sql = self.worker_store.sql_pool_store

        out_ftp, out_plain_http, out_soap = self.worker_store.worker_config.outgoing_connections()
        self.outgoing = Outgoing(out_ftp, out_amqp, out_zmq, out_jms_wmq, out_sql, out_plain_http, out_soap)

        is_sio = hasattr(self, 'SimpleIO')

        if self.passthrough_request:
            self.request = self.passthrough_request

        self.request.http.init(self.wsgi_environ)

        if is_sio:
            self.request.init(is_sio, self.cid, self.SimpleIO, self.data_format, self.transport, self.wsgi_environ)
            self.response.init(self.cid, self.SimpleIO, self.data_format)

        self.msg = MessageFacade(self.worker_store.msg_ns_store,
            self.worker_store.elem_path_store, self.worker_store.xpath_store)
예제 #3
0
파일: __init__.py 프로젝트: ptzagk/zato
    def __init__(self,
                 _get_logger=logging.getLogger,
                 _Bunch=Bunch,
                 _Request=Request,
                 _Response=Response,
                 _DictNav=DictNav,
                 _ListNav=ListNav,
                 _Outgoing=Outgoing,
                 _WMQFacade=WMQFacade,
                 _ZMQFacade=ZMQFacade,
                 *ignored_args,
                 **ignored_kwargs):
        self.name = self.__class__.__service_name  # Will be set through .get_name by Service Store
        self.impl_name = self.__class__.__service_impl_name  # Ditto
        self.logger = _get_logger(self.name)
        self.server = None
        self.broker_client = None
        self.channel = None
        self.cid = None
        self.in_reply_to = None
        self.data_format = None
        self.transport = None
        self.wsgi_environ = None
        self.job_type = None
        self.environ = _Bunch()
        self.request = _Request(self.logger)
        self.response = _Response(self.logger)
        self.invocation_time = None  # When was the service invoked
        self.handle_return_time = None  # When did its 'handle' method finished processing the request
        self.processing_time_raw = None  # A timedelta object with the processing time up to microseconds
        self.processing_time = None  # Processing time in milliseconds
        self.usage = 0  # How many times the service has been invoked
        self.slow_threshold = maxint  # After how many ms to consider the response came too late
        self.msg = None
        self.time = None
        self.patterns = None
        self.user_config = None
        self.dictnav = _DictNav
        self.listnav = _ListNav
        self.has_validate_input = False
        self.has_validate_output = False
        self.cache = None

        self.out = self.outgoing = _Outgoing(
            self.amqp,
            self._out_ftp,
            _WMQFacade(self) if self.component_enabled_ibm_mq else None,
            self._worker_config.out_odoo,
            self._out_plain_http,
            self._worker_config.out_soap,
            self._worker_store.sql_pool_store,
            self._worker_store.stomp_outconn_api,
            ZMQFacade(self.server) if self.component_enabled_zeromq else None,
            self._worker_store.outgoing_web_sockets,
            self._worker_store.vault_conn_api,
            SMSAPI(self._worker_store.sms_twilio_api)
            if self.component_enabled_sms else None,
            self._worker_config.out_sap,
        )
예제 #4
0
파일: __init__.py 프로젝트: saulm/zato
    def _init(self):
        """ Actually initializes the service.
        """
        self.odb = self.worker_store.odb
        self.kvdb = self.worker_store.kvdb

        self.slow_threshold = self.server.service_store.services[
            self.impl_name]['slow_threshold']

        out_amqp = PublisherFacade(self.broker_client)
        out_jms_wmq = WMQFacade(self.broker_client)
        out_zmq = ZMQFacade(self.broker_client)
        out_sql = self.worker_store.sql_pool_store

        out_ftp, out_plain_http, out_soap = self.worker_store.worker_config.outgoing_connections(
        )
        self.outgoing = Outgoing(out_ftp, out_amqp, out_zmq, out_jms_wmq,
                                 out_sql, out_plain_http, out_soap)

        if hasattr(self, 'SimpleIO'):
            self.request.init(self.cid, self.SimpleIO, self.data_format)
            self.response.init(self.cid, self.SimpleIO, self.data_format)