diff --git a/pkg/ctl/subscription/get_message_by_id.go b/pkg/ctl/subscription/get_message_by_id.go index 2bd8cc4f..aa4d94c8 100644 --- a/pkg/ctl/subscription/get_message_by_id.go +++ b/pkg/ctl/subscription/get_message_by_id.go @@ -31,41 +31,41 @@ import ( func GetMessageByIDCmd(vc *cmdutils.VerbCmd) { var desc cmdutils.LongDescription - desc.CommandUsedFor = "This command is used for getting messages by the given legerID and entryID" + + desc.CommandUsedFor = "This command is used for getting messages by the given ledgerID and entryID" + " for a subscription." desc.CommandPermission = "This command requires tenant admin and namespace produce or consume permissions." var examples []cmdutils.Example examples = append(examples, cmdutils.Example{ - Desc: "Get message by the given legerID an entryID", - Command: "pulsarctl subscription get-message-by-id --leger-id (leger-id) --entry-id (entry-id) (topic-name)", + Desc: "Get message by the given ledgerID an entryID", + Command: "pulsarctl subscription get-message-by-id --ledger-id (ledger-id) --entry-id (entry-id) (topic-name)", }) desc.CommandExamples = examples vc.SetDescription( "get-message-by-id", - "Getting messages by the given legerID and entryID", + "Getting messages by the given ledgerID and entryID", desc.ToString(), desc.ExampleToString(), ) - var legerID int64 + var ledgerID int64 var entryID int64 vc.SetRunFuncWithNameArg(func() error { - return doGetMessageByID(vc, legerID, entryID) + return doGetMessageByID(vc, ledgerID, entryID) }, "the topic name is not specified or the topic name is specified more than one") vc.FlagSetGroup.InFlagSet("GetMessageByID", func(set *pflag.FlagSet) { - set.Int64VarP(&legerID, "leger-id", "l", 0, "ledger id pointing to the desired ledger") - cobra.MarkFlagRequired(set, "leger-id") + set.Int64VarP(&ledgerID, "ledger-id", "l", 0, "ledger id pointing to the desired ledger") + cobra.MarkFlagRequired(set, "ledger-id") set.Int64VarP(&entryID, "entry-id", "e", 0, "entry id pointing to the desired entry") cobra.MarkFlagRequired(set, "entry-id") }) vc.EnableOutputFlagSet() } -func doGetMessageByID(vc *cmdutils.VerbCmd, legerID int64, entryID int64) error { +func doGetMessageByID(vc *cmdutils.VerbCmd, ledgerID int64, entryID int64) error { // for testing if vc.NameError != nil { return vc.NameError @@ -77,12 +77,12 @@ func doGetMessageByID(vc *cmdutils.VerbCmd, legerID int64, entryID int64) error } client := cmdutils.NewPulsarClient() - messages, err := client.Subscriptions().GetMessagesByID(*topic, legerID, entryID) + messages, err := client.Subscriptions().GetMessagesByID(*topic, ledgerID, entryID) if err != nil { return err } if len(messages) == 0 { - return fmt.Errorf("no message found with the given legerID and entryID") + return fmt.Errorf("no message found with the given ledgerID and entryID") } message := messages[0] propertiesJSON, err := json.Marshal(message.GetProperties())