Skip to content

Code duplication inside messages #96

Closed

Description

@Koc

Activity

  1. makasim commented on May 23, 2017

    @makasim
    Member

    That true, but I do not want to couple transports in any way. and I do not want to put more stuff to psr-queue lib.

  2. Koc commented on May 23, 2017

    @Koc
    Author

    It is ok put some common implementations to psr-layer. Something similar available for cache https://github.com/php-fig/cache-util/tree/master/src

  3. makasim commented on May 23, 2017

    @makasim
    Member

    Let's try it then.

  4. Koc commented on May 23, 2017

    @Koc
    Author

    Does messages implementations is different for different transports? Message is like value object, similar to cache item.

  5. makasim commented on May 23, 2017

    @makasim
    Member

    They are different. It may have additional stuff to what it the message interface require.

    For example. AMQP message has a delivery tag which is used while ack\reject.

  6. bendavies commented on May 23, 2017

    @bendavies
    Contributor
  7. makasim commented on May 23, 2017

    @makasim
    Member

    Yeap, that's my favorite.

  8. makasim commented on May 23, 2017

    @makasim
    Member

    DRY is not a silver bullet and could do harm as well

  9. makasim commented on May 25, 2017

    @makasim
    Member

    I give it a thought and me decided not to introduce a trait. There are the reasons:

    1. The most important. If we do a change in the trait because we need it in AMQP but at that time it breaks another Message from completely different transport.
    2. We remove duplication in easy to use and understand the code. Almost getters and setters
    3. The code is not expected to change often.

    The solution: Provide a spec test case for messages so every implementation could be tested against it. This is addressed here: https://github.com/php-enqueue/enqueue-dev/pull/102/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions