@@ -469,6 +469,41 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
469469 propMap [k ] = v
470470 }
471471
472+ // For FAIRMQ tasks, we append FairMQ channel configuration
473+ if class .Control .Mode == controlmode .FAIRMQ ||
474+ class .Control .Mode == controlmode .DIRECT {
475+ for _ , inbCh := range channel .MergeInbound (t .GetParent ().CollectInboundChannels (), class .Bind ) {
476+ endpoint , ok := t .localBindMap [inbCh .Name ]
477+ if ! ok {
478+ log .WithFields (logrus.Fields {
479+ "channelName" : inbCh .Name ,
480+ "taskName" : t .name ,
481+ }).
482+ Error ("endpoint not allocated for inbound channel" )
483+ continue
484+ }
485+
486+ // We get the FairMQ-formatted propertyMap from the inbound channel spec
487+ chanProps := inbCh .ToFMQMap (endpoint )
488+
489+ // And we copy it into the task's propertyMap
490+ for k , v := range chanProps {
491+ propMap [k ] = v
492+ }
493+ }
494+ for _ , outboundCh := range channel .MergeOutbound (t .GetParent ().CollectOutboundChannels (), class .Connect ) {
495+ // We get the FairMQ-formatted propertyMap from the outbound channel spec
496+ chanProps := outboundCh .ToFMQMap (bindMap )
497+
498+ // And if valid, we copy it into the task's propertyMap
499+ if len (chanProps ) > 0 {
500+ for k , v := range chanProps {
501+ propMap [k ] = v
502+ }
503+ }
504+ }
505+ } // end append FairMQ configuration
506+
472507 objStack := make (map [string ]interface {})
473508 objStack ["ToPtree" ] = template .MakeToPtreeFunc (varStack , propMap )
474509
@@ -503,40 +538,6 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
503538 }
504539 }
505540
506- // For FAIRMQ tasks, we append FairMQ channel configuration
507- if class .Control .Mode == controlmode .FAIRMQ ||
508- class .Control .Mode == controlmode .DIRECT {
509- for _ , inbCh := range channel .MergeInbound (t .GetParent ().CollectInboundChannels (), class .Bind ) {
510- endpoint , ok := t .localBindMap [inbCh .Name ]
511- if ! ok {
512- log .WithFields (logrus.Fields {
513- "channelName" : inbCh .Name ,
514- "taskName" : t .name ,
515- }).
516- Error ("endpoint not allocated for inbound channel" )
517- continue
518- }
519-
520- // We get the FairMQ-formatted propertyMap from the inbound channel spec
521- chanProps := inbCh .ToFMQMap (endpoint )
522-
523- // And we copy it into the task's propertyMap
524- for k , v := range chanProps {
525- propMap [k ] = v
526- }
527- }
528- for _ , outboundCh := range channel .MergeOutbound (t .GetParent ().CollectOutboundChannels (), class .Connect ) {
529- // We get the FairMQ-formatted propertyMap from the outbound channel spec
530- chanProps := outboundCh .ToFMQMap (bindMap )
531-
532- // And if valid, we copy it into the task's propertyMap
533- if len (chanProps ) > 0 {
534- for k , v := range chanProps {
535- propMap [k ] = v
536- }
537- }
538- }
539- }
540541 }
541542 return propMap
542543}
0 commit comments