Пример #1
0
        public Broker(string metadataDir = null, IRegistryProvider registryProvider = null)
        {
            _workingDir = Directory.GetCurrentDirectory();
            var binDir    = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var studioDir = Path.Combine(binDir, "studio");

            Log.Info("Studio dir: {0}", studioDir);
            metadataDir = Path.GetFullPath(metadataDir ?? Path.Combine(_workingDir, "metadata"));
            Log.Info("Metadata dir: {0}", metadataDir);
            var metadataFile = Path.Combine(metadataDir, "interop.json");

            _transportServers = new[]
            {
                TransportServerFactory.Instance.Create(
                    PipeTransmissionServerFactory.Instance.Create(_workingDir), DefaultTransportSerializationProvider),
                TransportServerFactory.Instance.Create(
                    WebSocketTransmissionServerFactory.Instance.Create(
                        _workingDir,
                        new Dictionary <string, string> {
                    { "/metadata/interop", metadataFile }, { "/studio", studioDir }
                }),
                    DefaultTransportSerializationProvider)
            };
            _connectionListener  = new ServerConnectionListener(_transportServers);
            registryProvider     = registryProvider ?? JsonRegistryProvider.Initialize(Path.Combine(metadataDir, "interop.json"));
            _appLifecycleManager = AppLifecycleManagerFactory.Instance.Create(metadataDir);
            _brokerProcessor     = BrokerProcessorFactory.Instance.Create(
                _connectionListener.In,
                registryProvider,
                DefaultProtocolSerializationProvider,
                _appLifecycleManager);
            OnStop(_connectionListener.Stop);
        }
Пример #2
0
 public BrokerRunner(string metadataDir = null, IRegistryProvider registryProvider = null)
 {
     _workingDir       = Path.GetFullPath(Directory.GetCurrentDirectory());
     metadataDir       = metadataDir ?? _workingDir;
     _registryProvider = registryProvider ??
                         JsonRegistryProvider.Initialize(Path.Combine(metadataDir, "interop.json"));
     _instanceSemaphore   = new Semaphore(1, 1, $"Global{Path.DirectorySeparatorChar}plexus-interop-broker-semaphore-{_workingDir.Replace(Path.DirectorySeparatorChar, ':')}");
     _transportServer     = new CompositeTransportServer(new[] { CreateNamedPipeServer(), CreateWebSocketServer() });
     _appLifecycleManager = new AppLifecycleManager(metadataDir, _workingDir);
 }
Пример #3
0
 public BrokerRunner(string metadataDir = null, IRegistryProvider registryProvider = null)
 {
     _workingDir       = Directory.GetCurrentDirectory();
     metadataDir       = metadataDir ?? Path.Combine(_workingDir, "metadata");
     _transportServers = new ITransportServer[]
     {
         new TransportServer(new PipeTransmissionServer(_workingDir), DefaultTransportSerializationProvider),
         new TransportServer(new WebSocketTransmissionServer(_workingDir), DefaultTransportSerializationProvider)
     };
     _connectionListener = new ServerConnectionListener(_transportServers);
     registryProvider    = registryProvider ?? JsonRegistryProvider.Initialize(Path.Combine(metadataDir, "interop.json"));
     _connectionTracker  = new AppLifecycleManager(metadataDir);
     _brokerProcessor    = new BrokerProcessor(
         _connectionListener.In,
         registryProvider,
         DefaultProtocolSerializationProvider,
         _connectionTracker);
     OnStop(_connectionListener.Stop);
 }
 public RegistryServiceTests()
 {
     _sut = new RegistryService(JsonRegistryProvider.Initialize("RegistryServiceTests.interop.json"));
 }