< Back

Get-GcpsMessage

Mon Jan 13, 2020 11:18 pm

NAME Get-GcpsMessage



SYNOPSIS

Gets a Google Cloud PubSub message from a pull config subscription.





SYNTAX

Get-GcpsMessage [-Project <string>] [-Name] <string> [-MaxMessages <int>] [-AutoAck <SwitchParameter>]

[-ReturnImmediately <SwitchParameter>] [<CommonParameters>]





DESCRIPTION

Gets a Google Cloud PubSub message from a pull config subscription. Will raise errors if the subscription does not

exist. The default project will be used to search for the subscription if -Project is not used. If -AutoAck switch

is supplied, each message received will be acknowledged automatically. If there is more than one message for the

subscription, the cmdlet may not get all of them in one call. By default, the cmdlet will block until at least one

message is returned. If -ReturnImmediately is used, the cmdlet will not block.





PARAMETERS

-Project <string>

The project to check for the subscription. If not set via PowerShell parameter processing, will default to the

Cloud SDK's DefaultProject property.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string>

The name of the subscription to pull the messages from.



Required? true

Position? 0

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Subscription <string>

The name of the subscription to pull the messages from.



This is an alias of the Name parameter.



Required? true

Position? 0

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-MaxMessages <int>

The maximum number of messages that can be returned.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AutoAck <SwitchParameter>

If set, automatically send acknowledgement for each message received.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ReturnImmediately <SwitchParameter>

If set, the cmdlet will not block when there are no messages.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String

The name of the subscription to pull the messages from.





OUTPUTS



---------- EXAMPLE 1 ----------



PS C:\\> Get-GcpsMessage -Subscription "my-subscription"



This command pulls down one or more messages from the subscription "my-subscription" in the default project.

---------- EXAMPLE 2 ----------



PS C:\\> Get-GcpsMessage -Subscription "my-subscription" -ReturnImmediately



This command pulls down one or more messages from the subscription "my-subscription" in the default project and it

will not block even if no messages are returned.

---------- EXAMPLE 3 ----------



PS C:\\> Get-GcpsMessage -Subscription "my-subscription" -Project "my-project" -MaxMessage 10



This command pulls down a maximum of 10 messages from the subscription "my-subscription" in the project

"my-project".

---------- EXAMPLE 4 ----------



PS C:\\> Get-GcpsMessage -Subscription "my-subscription" -AutoAck



This command pulls down one or more messages from the subscription "my-subscription" in the default project and

sends an acknowledgement for each message.



RELATED LINKS

[PubSub Message] (https://cloud.google.com/pubsub/docs/re ... subMessage)

[Receiving Pull Messages] (https://cloud.google.com/pubsub/docs/su ... l-messages)