twingly-amqp 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +4 -1
 - data/lib/twingly/amqp/publisher.rb +6 -6
 - data/lib/twingly/amqp/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 72327e797eeb0baacb83fa4a8680f6108a2cacdc6aa1185bbd3dfd855a1738c9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a0fee780601c0d0bed3afa6f4a70e99fe775c09c3f72b8674f5ac840103252c5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3d7692b89922e73d8c9056a863f5039371c4ac1962d2419fe5144d00f553ad343b989d3dcc70e727902f3a3c3dc6ad981a6de0cdacd9cb189295413a5b7428ca
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d50510058e01960b482712b3719182ca32a88854c0ded35c967b91cca087cd083f37ac67e892c9f960ca0fc6d00da73ab3792cc9f38bf5d0347db91ffe7d3f41
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Twingly::AMQP
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            [](https://github.com/twingly/twingly-amqp/actions)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            A gem for subscribing and publishing messages via RabbitMQ.
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
         @@ -132,6 +132,9 @@ publisher.configure_publish_options do |options| 
     | 
|
| 
       132 
132 
     | 
    
         
             
            end
         
     | 
| 
       133 
133 
     | 
    
         | 
| 
       134 
134 
     | 
    
         
             
            publisher.publish({ my: "data" })
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            publisher.publish({ my: "other_data" }, routing_key: "my_other_key") # Override routing_key or other publishing options
         
     | 
| 
      
 137 
     | 
    
         
            +
                                                                                 # accepted by Bunny::Exchange#publish
         
     | 
| 
       135 
138 
     | 
    
         
             
            ```
         
     | 
| 
       136 
139 
     | 
    
         | 
| 
       137 
140 
     | 
    
         
             
            ### Publish delayed messages
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Twingly
         
     | 
| 
       2 
2 
     | 
    
         
             
              module AMQP
         
     | 
| 
       3 
3 
     | 
    
         
             
                module Publisher
         
     | 
| 
       4 
     | 
    
         
            -
                  def publish(message)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def publish(message, opts = {})
         
     | 
| 
       5 
5 
     | 
    
         
             
                    payload =
         
     | 
| 
       6 
6 
     | 
    
         
             
                      if message.kind_of?(Array)
         
     | 
| 
       7 
7 
     | 
    
         
             
                        message
         
     | 
| 
         @@ -11,17 +11,17 @@ module Twingly 
     | 
|
| 
       11 
11 
     | 
    
         
             
                        raise ArgumentError
         
     | 
| 
       12 
12 
     | 
    
         
             
                      end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                    json_payload 
     | 
| 
       15 
     | 
    
         
            -
                     
     | 
| 
       16 
     | 
    
         
            -
                    @exchange.publish(json_payload,  
     | 
| 
      
 14 
     | 
    
         
            +
                    json_payload       = payload.to_json
         
     | 
| 
      
 15 
     | 
    
         
            +
                    publishing_options = options.to_h.merge(opts)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @exchange.publish(json_payload, publishing_options)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                  # Only used by tests to lessen the time we need to sleep
         
     | 
| 
       20 
     | 
    
         
            -
                  def publish_with_confirm(message)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def publish_with_confirm(message, opts = {})
         
     | 
| 
       21 
21 
     | 
    
         
             
                    channel = @exchange.channel
         
     | 
| 
       22 
22 
     | 
    
         
             
                    channel.confirm_select unless channel.using_publisher_confirmations?
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                    publish(message)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    publish(message, opts)
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                    @exchange.wait_for_confirms
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/twingly/amqp/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: twingly-amqp
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 6.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Twingly AB
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-12-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bunny
         
     |