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

ParameterShovelValue.deleteafter doesn't work with integers #61

Open
inikulshin opened this issue Jan 25, 2018 · 5 comments
Open

ParameterShovelValue.deleteafter doesn't work with integers #61

inikulshin opened this issue Jan 25, 2018 · 5 comments
Labels

Comments

@inikulshin
Copy link
Contributor

Probably, deleteafter JsonProperty should have special JsonConverter, writing it as integer if value can be converted to integer, and as a string otherwise.

@inikulshin
Copy link
Contributor Author

Also, delete-after property seems to be deprecated in some RabbitMQ version, and src-delete-after should be used instead.

@micdenny
Copy link
Member

@inikulshin if you found the error in the source code, a PR will be much appreciated, thank you 😄

@luigiberrettini
Copy link
Member

@luigiberrettini luigiberrettini changed the title ParameterShovelValue.deleteafter doesn't work with integer values ParameterShovelValue.deleteafter doesn't work with integers Jul 3, 2018
@inikulshin
Copy link
Contributor Author

@Pliner what's the best type for SrcDeleteAfter (every solution will require custom JsonConverter):

  1. record DeleteAfter(DeleteAfterEnum, int?)
    1. SrcDeleteAfter = new DeleteAfter(DeleteAfterEnum.Never)
    2. SrcDeleteAfter = new DeleteAfter(DeleteAfterEnum.QueueLength)
    3. SrcDeleteAfter = new DeleteAfter(10)
  2. string (custom JsonConverter will read/write integer if can be parsed from string)
    1. SrcDeleteAfter = DeleteAfterNever // readonly string DeleteAfterNever = "never"
    2. SrcDeleteAfter = DeleteAfterQueueLength // readonly string DeleteAfterNever = "queue-length"
    3. SrcDeleteAfter = "10"
  3. enum DeleteAfter { Never = -1, QueueLength = -2 } and every other value is treated as integer
    1. SrcDeleteAfter = DeleteAfter.Never
    2. SrcDeleteAfter = DeleteAfter.QueueLength
    3. SrcDeleteAfter = (DeleteAfter)10

@inikulshin
Copy link
Contributor Author

@zidad see previous comment.

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

No branches or pull requests

3 participants