public ServiceAttribute(
     Type registerFrom,
     ServiceBehaviour behaviour = ServiceBehaviour.NewInstance,
     ServiceScope scope = ServiceScope.Web,
     ServiceEnvironemnt environemnt = ServiceEnvironemnt.Anywhere,
     bool addInterfaceInterceptor = false)
     : base(registerFrom, behaviour, scope, environemnt, addInterfaceInterceptor)
 {
 }
 protected ServiceContextAttribute(
     Type registerFrom,
     ServiceBehaviour behaviour = ServiceBehaviour.NewInstance,
     ServiceScope scope = ServiceScope.Web,
     ServiceEnvironemnt environemnt = ServiceEnvironemnt.Anywhere,
     bool addInterfaceInterceptor = false)
 {
     this.RegisterFrom = registerFrom;
     this.Behaviour = behaviour;
     this.Scope = scope;
     this.AddInterfaceInterceptor = addInterfaceInterceptor;
     this.Environment = environemnt;
 }
 /// <summary>
 /// Creates a new trace begin event arguments.
 /// </summary>
 /// <param name="envelope">The envelope.</param>
 /// <param name="behaviour">The behaviour.</param>
 public TraceEventArgs(Envelope envelope, ServiceBehaviour behaviour)
 {
     Envelope  = envelope;
     Behaviour = behaviour;
 }
Exemple #4
0
 /// <summary>
 /// Attaches the service behaviour to the address, defaults to a fanout service type.
 /// </summary>
 /// <param name="addr">The service address.</param>
 /// <param name="behaviour">The service behaviour.</param>
 /// <returns></returns>
 public Task <Service> AttachAsync(string addr, ServiceBehaviour behaviour)
 {
     return(AttachAsync(new ServiceAddress(addr), ServiceType.Fanout, ServiceExecution.Serial, behaviour));
 }
Exemple #5
0
 /// <summary>
 /// Attaches the service provider to the address.
 /// </summary>
 /// <param name="addr">The address.</param>
 /// <param name="type">The service type.</param>
 /// <param name="behaviour">The behaviour.</param>
 /// <returns></returns>
 public Task <Service> AttachAsync(ServiceAddress addr, ServiceType type, ServiceBehaviour behaviour)
 {
     return(AttachAsync(addr, type, ServiceExecution.Serial, behaviour));
 }
Exemple #6
0
 /// <summary>
 /// Attaches the service provider to the address.
 /// </summary>
 /// <param name="addr">The address.</param>
 /// <param name="type">The service type.</param>
 /// <param name="execution">The service execution.</param>
 /// <param name="behaviour">The behaviour.</param>
 /// <returns>The attached service.</returns>
 public Task <Service> AttachAsync(string addr, ServiceType type, ServiceExecution execution, ServiceBehaviour behaviour)
 {
     return(AttachAsync(new ServiceAddress(addr), type, execution, behaviour));
 }
Exemple #7
0
 /// <summary>
 /// Attaches the service provider to the address.
 /// </summary>
 /// <param name="addr">The service address.</param>
 /// <param name="type">The service type.</param>
 /// <param name="execution">The service execution.</param>
 /// <param name="behaviour">The service behaviour.</param>
 /// <returns>The attached service.</returns>
 public Task <Service> AttachAsync(ServiceAddress addr, ServiceType type, ServiceExecution execution, ServiceBehaviour behaviour)
 {
     return(AttachAsync(addr, new ServiceConfiguration()
     {
         Type = type,
         Execution = execution
     }, behaviour));
 }
Exemple #8
0
 /// <summary>
 /// Attaches the service provider to the address.
 /// </summary>
 /// <param name="addr">The service address.</param>
 /// <param name="configuration">The service configuration.</param>
 /// <param name="behaviour">The service behaviour.</param>
 /// <returns>The attached service.</returns>
 public Task <Service> AttachAsync(string addr, ServiceConfiguration configuration, ServiceBehaviour behaviour)
 {
     return(AttachAsync(new ServiceAddress(addr), configuration, behaviour));
 }
Exemple #9
0
        /// <summary>
        /// Attaches the service provider to the address.
        /// </summary>
        /// <param name="addr">The service address.</param>
        /// <param name="configuration">The service configuration.</param>
        /// <param name="behaviour">The service behaviour.</param>
        /// <returns>The attached service.</returns>
        public async Task <Service> AttachAsync(ServiceAddress addr, ServiceConfiguration configuration, ServiceBehaviour behaviour)
        {
            // get namespace
            Namespace @namespace = GetNamespace(addr.Namespace);

            // create service
            Service service = new Service(@namespace, addr, behaviour, configuration);

            if (_configuration.ThrowUnhandledExceptions)
            {
                service.UnhandledException += (o, e) => throw e.Exception;
            }

            // setup service
            await @namespace.SetupServiceAsync(service).ConfigureAwait(false);

            lock (_services) {
                _services.Add(service);
            }

            return(service);
        }
Exemple #10
0
        /// <summary>
        /// Attaches the service provider to the address.
        /// </summary>
        /// <param name="addr">The service address.</param>
        /// <param name="configuration">The service configuration.</param>
        /// <param name="behaviour">The service behaviour.</param>
        /// <returns>The attached service.</returns>
        public async Task <Service> AttachAsync(ServiceAddress addr, ServiceConfiguration configuration, ServiceBehaviour behaviour)
        {
            // create service
            Service service = new Service(this, _broker, addr, behaviour, configuration);

            if (_configuration.ThrowUnhandledExceptions)
            {
                service.UnhandledException += (o, e) => throw e.Exception;
            }

            // create queue
            await service.SetupAsync().ConfigureAwait(false);

            lock (_services) {
                _services.Add(service);
            }

            return(service);
        }