chore: seed migration objects batch 5
This commit is contained in:
@@ -26,27 +26,24 @@ func (q *qImAdminCommandResult) GetTopic() string {
|
||||
}
|
||||
|
||||
func (q *qImAdminCommandResult) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
|
||||
var envelope imkafka.Envelope
|
||||
if err = json.Unmarshal(mqMsg.Body, &envelope); err == nil && envelope.EventID != "" && len(envelope.Payload) > 0 {
|
||||
var result imkafka.CommandResult
|
||||
if err = json.Unmarshal(envelope.Payload, &result); err != nil {
|
||||
return err
|
||||
}
|
||||
if result.CommandEventID == "" {
|
||||
result.CommandEventID = envelope.ParentEventID
|
||||
}
|
||||
if result.TenantCode == "" {
|
||||
result.TenantCode = envelope.TenantCode
|
||||
}
|
||||
if result.EventID == "" {
|
||||
result.EventID = envelope.EventID
|
||||
}
|
||||
return imkafka.ApplyCommandResult(ctx, result)
|
||||
}
|
||||
|
||||
var result imkafka.CommandResult
|
||||
if err = json.Unmarshal(mqMsg.Body, &result); err != nil {
|
||||
return err
|
||||
}
|
||||
if result.CommandID == "" && result.CommandEventID == "" {
|
||||
var envelope imkafka.Envelope
|
||||
if err = json.Unmarshal(mqMsg.Body, &envelope); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(envelope.Payload) > 0 {
|
||||
if err = json.Unmarshal(envelope.Payload, &result); err != nil {
|
||||
return err
|
||||
}
|
||||
result.EventID = envelope.EventID
|
||||
result.TraceID = envelope.TraceID
|
||||
result.TenantCode = envelope.TenantCode
|
||||
result.OccurredAt = envelope.OccurredAt
|
||||
}
|
||||
}
|
||||
return imkafka.ApplyCommandResult(ctx, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user