Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send-RabbitMqMessage send allways the same body when pipeline is used #30

Open
code-numericoverflow opened this issue Jan 17, 2020 · 1 comment · Fixed by tolmachev-pravo/PSRabbitMq#1

Comments

@code-numericoverflow
Copy link

When using the pipeline the body is not re-calculated for each inputObject, $Body is tested to be re-created and has a value. I changed to:

     process
    {
        **$Body = $null**
        switch ($SerializeAs) {

@Dragonsong3k
Copy link

I believe I have the same issue:

`
#Send a message - Works fine
Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange -Key $routing_key -InputObject $message -ContentType 'application/json' @params -ErrorAction Stop

#In same terminal set a variable $Body to something
$Body = "something"

#Send the same message as before again.
Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange -Key $routing_key -InputObject $message -ContentType 'application/json' @params -ErrorAction Stop

Send-RabbitMqMessage : Cannot convert argument "body", with value: "thing", for "BasicPublish" to type "System.Byte[]": "Cannot convert value
"thing" to type "System.Byte[]". Error: "Cannot convert value "thing" to type "System.Byte". Error: "Input string was not in a correct format."""
At line:1 char:1

  • Send-RabbitMqMessage -ComputerName $messageServer -Exchange $exchange ...
  •   + CategoryInfo          : NotSpecified: (:) [Send-RabbitMqMessage], MethodException
      + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument,Send-RabbitMqMessage
    

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants