@@ -79,7 +79,37 @@ chans.data1.0.type = pull
7979chans.data1.numSockets = 1
8080*/
8181
82- func (outbound * Outbound ) ToFMQMap (endpoint Endpoint ) (pm controlcommands.PropertyMap ) {
82+ func (outbound * Outbound ) ToFMQMap (bindMap BindMap ) (pm controlcommands.PropertyMap ) {
83+ if outbound == nil {
84+ return
85+ }
86+
87+ var address string
88+ // If an explicit target was provided, we use it
89+ if strings .HasPrefix (outbound .Target , "tcp://" ) ||
90+ strings .HasPrefix (outbound .Target , "ipc://" ) {
91+ address = outbound .Target
92+ } else {
93+ // we don't need class.Bind data for this one, only task.bindPorts after resolving paths!
94+ for chPath , endpoint := range bindMap {
95+ // FIXME: implement more sophisticated channel matching here
96+ if outbound .Target == chPath {
97+
98+ // We have a match, so we generate a resolved target address and break
99+ address = fmt .Sprintf ("tcp://%s:%d" , endpoint .Host , endpoint .Port )
100+ break
101+ }
102+ }
103+ }
104+
105+ if len (address ) == 0 {
106+ return
107+ }
108+
109+ return outbound .buildFMQMap (address )
110+ }
111+
112+ func (outbound * Outbound ) buildFMQMap (address string ) (pm controlcommands.PropertyMap ) {
83113 pm = make (controlcommands.PropertyMap )
84114 const chans = "chans"
85115 chName := outbound .Name
@@ -88,7 +118,7 @@ func (outbound *Outbound) ToFMQMap(endpoint Endpoint) (pm controlcommands.Proper
88118 prefix := strings .Join ([]string {chans , chName , "0" }, "." )
89119
90120 chanProps := controlcommands.PropertyMap {
91- "address" : fmt . Sprintf ( "tcp://%s:%d" , endpoint . Host , endpoint . Port ) ,
121+ "address" : address ,
92122 "method" : "connect" ,
93123 "rateLogging" : strconv .Itoa (outbound .RateLogging ),
94124 "rcvBufSize" : strconv .Itoa (outbound .RcvBufSize ),
0 commit comments