robocanic commented on code in PR #1340:
URL: https://github.com/apache/dubbo-admin/pull/1340#discussion_r2450146833


##########
pkg/core/engine/component.go:
##########
@@ -41,25 +45,59 @@ type Component interface {
 var _ Component = &engineComponent{}
 
 type engineComponent struct {
-       name      string
-       informers []controller.Informer
+       name                string
+       storeRouter         store.Router
+       informers           []controller.Informer
+       subscriptionManager events.SubscriptionManager
+       subscribers         []events.Subscriber
 }
 
 func newEngineComponent() Component {
        return &engineComponent{
-               informers: make([]controller.Informer, 0),
+               informers:   make([]controller.Informer, 0),
+               subscribers: make([]events.Subscriber, 0),
        }
 }
-func (b *engineComponent) Type() runtime.ComponentType {
+func (e *engineComponent) Type() runtime.ComponentType {
        return runtime.ResourceEngine
 }
 
-func (b *engineComponent) Order() int {
-       return math.MaxInt
+func (e *engineComponent) Order() int {
+       return math.MaxInt - 3
 }
 
-func (b *engineComponent) Init(ctx runtime.BuilderContext) error {
+func (e *engineComponent) Init(ctx runtime.BuilderContext) error {
        cfg := ctx.Config().Engine
+       e.name = cfg.Name
+       eventBusComponent, err := ctx.GetActivatedComponent(runtime.EventBus)
+       if err != nil {
+               return fmt.Errorf("can not retrieve event bus from runtime in 
engine %s, %w", cfg.Name, err)

Review Comment:
   ignored



##########
pkg/core/engine/component.go:
##########
@@ -41,25 +45,59 @@ type Component interface {
 var _ Component = &engineComponent{}
 
 type engineComponent struct {
-       name      string
-       informers []controller.Informer
+       name                string
+       storeRouter         store.Router
+       informers           []controller.Informer
+       subscriptionManager events.SubscriptionManager
+       subscribers         []events.Subscriber
 }
 
 func newEngineComponent() Component {
        return &engineComponent{
-               informers: make([]controller.Informer, 0),
+               informers:   make([]controller.Informer, 0),
+               subscribers: make([]events.Subscriber, 0),
        }
 }
-func (b *engineComponent) Type() runtime.ComponentType {
+func (e *engineComponent) Type() runtime.ComponentType {
        return runtime.ResourceEngine
 }
 
-func (b *engineComponent) Order() int {
-       return math.MaxInt
+func (e *engineComponent) Order() int {
+       return math.MaxInt - 3
 }
 
-func (b *engineComponent) Init(ctx runtime.BuilderContext) error {
+func (e *engineComponent) Init(ctx runtime.BuilderContext) error {
        cfg := ctx.Config().Engine
+       e.name = cfg.Name
+       eventBusComponent, err := ctx.GetActivatedComponent(runtime.EventBus)
+       if err != nil {
+               return fmt.Errorf("can not retrieve event bus from runtime in 
engine %s, %w", cfg.Name, err)
+       }
+       eventBus, ok := eventBusComponent.(events.EventBus)
+       if !ok {
+               return bizerror.NewAssertionError("EventBus", 
reflect.TypeOf(eventBusComponent).Name())
+       }
+       e.subscriptionManager = eventBus
+       storeComponent, err := ctx.GetActivatedComponent(runtime.ResourceStore)
+       if err != nil {
+               return fmt.Errorf("can not retrieve store from runtime in 
engine %s, %w", e.name, err)

Review Comment:
   ignored



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to