public void Deploy(Application app)
{
// Setup application
app.HostService = this;
foreach (Port port in app.Ports)
{
foreach (var encoder in port.Encoders)
{
AddPipelineComponent(port.Endpoint, encoder);
}
foreach (var assembler in port.Assembers)
{
AddPipelineComponent(port.Endpoint, assembler);
}
}
// Setup channels
foreach (var channel in app.Channels)
{
channel.HostService = this;
foreach (var destination in channel.Destinations)
{
destination.Channel = channel;
}
channel.Source.Channel = channel;
}
// Setup endpoints
foreach (var port in app.Ports)
{
port.Endpoint.Initialize(this, null);
}
Applications.Add(app);
}