Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IgniteClient"/> class.
        /// </summary>
        /// <param name="clientConfiguration">The client configuration.</param>
        public IgniteClient(IgniteClientConfiguration clientConfiguration)
        {
            Debug.Assert(clientConfiguration != null);

            _configuration = new IgniteClientConfiguration(clientConfiguration);

            _marsh = new Marshaller(_configuration.BinaryConfiguration)
            {
                Ignite = this
            };

            _transactions = new TransactionsClient(this, clientConfiguration.TransactionConfiguration);

            _socket = new ClientFailoverSocket(_configuration, _marsh, _transactions);

            _binProc = _configuration.BinaryProcessor ?? new BinaryProcessorClient(_socket);

            _binary = new Impl.Binary.Binary(_marsh);

            _cluster = new ClientCluster(this);

            _compute = new ComputeClient(this, ComputeClientFlags.None, TimeSpan.Zero, null);

            _services = new ServicesClient(this);
        }
Exemplo n.º 2
0
        public static void Services()
        {
            var cfg = new IgniteClientConfiguration();
            //tag::client-services[]
            IIgniteClient   client       = Ignition.StartClient(cfg);
            IServicesClient services     = client.GetServices();
            IMyService      serviceProxy = services.GetServiceProxy <IMyService>("MyService");

            serviceProxy.MyServiceMethod("hello");
            //end::client-services[]
        }
Exemplo n.º 3
0
        /// <summary>
        /// Smoke Test for using a proxy configured throught SDK properties.
        /// </summary>
        public async Task Test()
        {
            using (Client client = GetClient())
            {
                IServicesClient services = client
                                           .WithNewMerchant(GetMerchantId())
                                           .Services;

                Assert.That(services, Is.TypeOf(typeof(ServicesClient)));
                CommunicatorConfiguration configuration = GetCommunicatorConfiguration();
                Assert.NotNull(configuration.Proxy);
                AssertProxyAndAuthentication(GetConnectionFromService(services), configuration.Proxy);

                TestConnection response = await services.TestConnection()
                                          .ConfigureAwait(false);

                Assert.NotNull(response.Result);
            }
        }
Exemplo n.º 4
0
        static DefaultConnection GetConnectionFromService(IServicesClient services)
        {
            Communicator communicator = (Communicator)services.GetPrivateField("_communicator");

            return(communicator.GetPrivateProperty <DefaultConnection>("Connection"));
        }