in internal/pkg/core/deployers/deployers.go [148:184]
func (d *Deployer) DeployInbounds(ctx context.Context, fileName string, xmlData string) {
position := artifacts.Position{FileName: fileName}
inboundEp := types.Inbound{}
newInbound, err := inboundEp.Unmarshal(xmlData, position)
if err != nil {
d.logger.Error("Error unmarshalling inbound:", "error", err)
return
}
configContext := ctx.Value(utils.ConfigContextKey).(*artifacts.ConfigContext)
configContext.AddInbound(newInbound)
d.logger.Info("Deployed inbound: " + newInbound.Name)
// Start the inbound endpoint
parametersMap := make(map[string]string)
for _, param := range newInbound.Parameters {
parametersMap[param.Name] = param.Value
}
inboundEndpoint, err := inbound.NewInbound(domain.InboundConfig{
SequenceName: newInbound.Sequence,
Name: newInbound.Name,
Protocol: newInbound.Protocol,
Parameters: parametersMap,
})
if err != nil {
d.logger.Error("Error creating inbound endpoint:", "error", err)
return
}
wg := ctx.Value(utils.WaitGroupKey).(*sync.WaitGroup)
wg.Add(1)
go func(endpoint ports.InboundEndpoint) {
defer wg.Done()
if err := endpoint.Start(ctx, d.inboundMediator); err != nil {
d.logger.Error("Error starting inbound endpoint:", "error", err)
}
}(inboundEndpoint)
}