diff --git a/go.mod b/go.mod index 3fe7f1a4..655367bf 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/viant/afsc v1.9.1 github.com/viant/assertly v0.9.1-0.20220620174148-bab013f93a60 github.com/viant/bigquery v0.3.3 - github.com/viant/cloudless v1.9.8 + github.com/viant/cloudless v1.9.9-0.20240725200737-56bb7758eb19 github.com/viant/dsc v0.16.2 // indirect github.com/viant/dsunit v0.10.8 github.com/viant/dyndb v0.1.4-0.20221214043424-27654ab6ed9c diff --git a/go.sum b/go.sum index 80ef6e0b..65c94991 100644 --- a/go.sum +++ b/go.sum @@ -1097,6 +1097,8 @@ github.com/viant/bigquery v0.3.3 h1:ZJw4FtfrmYAJwf8T5nz0PYdHlb7ixHLpCN7+y+akjBo= github.com/viant/bigquery v0.3.3/go.mod h1:EYjfaKz5a0ho9Wg48+NzHnwOuA+Q81c0I0lBUEtsX8s= github.com/viant/cloudless v1.9.8 h1:iMI/KgBlo8jGZjb++QH4y04R0C1oAw0elHC+18Uy1m8= github.com/viant/cloudless v1.9.8/go.mod h1:t6BDFAXg3s3/aULrPrR885vNmyI4MoHfXNu+TIzl/M0= +github.com/viant/cloudless v1.9.9-0.20240725200737-56bb7758eb19 h1:13rce4aHIXgKY+Lig3vG65FDiRIOaymn3fMc9A0XXjw= +github.com/viant/cloudless v1.9.9-0.20240725200737-56bb7758eb19/go.mod h1:t6BDFAXg3s3/aULrPrR885vNmyI4MoHfXNu+TIzl/M0= github.com/viant/dsc v0.16.2 h1:Kw8zNct6dTISVZpartYK4MlKiwSSqIdRSq5CYjtZcc4= github.com/viant/dsc v0.16.2/go.mod h1:vkBPh3XSXUBB/ePbEO0VsKPaiN4JLRuB3QVftbS6KI4= github.com/viant/dsunit v0.10.8 h1:egq8LH4ogXTweFhzl/RqPhM9PNJtG35sbe02KnjFj3I= diff --git a/internal/translator/mbus.go b/internal/translator/mbus.go index c2723462..780cdaa2 100644 --- a/internal/translator/mbus.go +++ b/internal/translator/mbus.go @@ -30,7 +30,7 @@ func (r *Repository) ensureMBus(ctx context.Context) error { if err != nil { return err } - messageBuses[resource.Name] = resource + messageBuses[resource.ID] = resource mbusResource = append(mbusResource, resource) } } @@ -38,7 +38,7 @@ func (r *Repository) ensureMBus(ctx context.Context) error { //load previous defined message buses if prevResource, _ := r.loadDependency(ctx, "mbus.yaml"); prevResource != nil { for _, item := range prevResource.MessageBuses { - if _, ok := messageBuses[item.Name]; ok { + if _, ok := messageBuses[item.ID]; ok { continue } mbusResource = append(mbusResource, item) diff --git a/service/executor/extension/session.go b/service/executor/extension/session.go index 518395e9..77441942 100644 --- a/service/executor/extension/session.go +++ b/service/executor/extension/session.go @@ -121,7 +121,7 @@ func WithMessageBus(messageBusses []*mbus.Resource) Option { return func(s *Session) { s.messageBusses = map[string]*mbus.Resource{} for _, bus := range messageBusses { - s.messageBusses[bus.Name] = bus + s.messageBusses[bus.ID] = bus } } } diff --git a/service/executor/mbus/service.go b/service/executor/mbus/service.go index 0d0825b2..59cb2474 100644 --- a/service/executor/mbus/service.go +++ b/service/executor/mbus/service.go @@ -34,10 +34,10 @@ func (s *Service) Message(dest string, data interface{}) (*mbus.Message, error) } URI := strings.Join(parts[3:], "/") if len(parts) > 4 { - resource.URL = URI - resource.Name = parts[len(parts)-1] - } else { resource.Name = URI + resource.ID = parts[len(parts)-1] + } else { + resource.ID = URI } return &mbus.Message{Data: data, Resource: resource}, nil } diff --git a/view/mbus.go b/view/mbus.go index 935335f3..06c8e380 100644 --- a/view/mbus.go +++ b/view/mbus.go @@ -21,12 +21,12 @@ func (m MessageBusSlice) Index() MessageBuses { return result } for i, item := range m { - result[item.Name] = m[i] + result[item.ID] = m[i] } return result } -//Lookup returns message bus for supplied name or error +// Lookup returns message bus for supplied name or error func (m MessageBuses) Lookup(name string) (*mbus.Resource, error) { ret, ok := m[name] if !ok { diff --git a/view/resource.go b/view/resource.go index fc41f2bd..f1adefbb 100644 --- a/view/resource.go +++ b/view/resource.go @@ -616,7 +616,7 @@ func (r *Resource) AddMessageBus(messageBuses ...*mbus.Resource) { } for i, messageBus := range messageBuses { - if _, ok := r._messageBuses[messageBus.Name]; ok { + if _, ok := r._messageBuses[messageBus.ID]; ok { continue } r.MessageBuses = append(r.MessageBuses, messageBuses[i]) @@ -741,7 +741,7 @@ func (r *Resource) mergeMessageBuses(resource *Resource) { } messageBusByName := MessageBusSlice(r.MessageBuses).Index() for i, candidate := range resource.MessageBuses { - if _, ok := messageBusByName[candidate.Name]; !ok { + if _, ok := messageBusByName[candidate.ID]; !ok { messageBus := *resource.MessageBuses[i] r.MessageBuses = append(r.MessageBuses, &messageBus) }