Announcement Announcement Module
Collapse
No announcement yet.
Support for ReturnListener on RabbitTemplate??? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Support for ReturnListener on RabbitTemplate???

    I don't see a way to register a ReturnListener (used for mandatory and immediate undeliverable messages) on RabbitTemplate? It seems basic functionality... Plans to add it on future realease?

    Thanks,


    nicolas.loriente

  • #2
    It was added in the 1.1.0.RELEASE; current version is 1.1.1.RELEASE.

    See
    Code:
    	public void setReturnCallback(ReturnCallback returnCallback)
    .

    The RabbitTemplate.ReturnCallback looks like this...

    Code:
    	public static interface ReturnCallback {
    
    		void returnedMessage(Message message, int replyCode, String replyText,
    				String exchange, String routingKey);
    	}
    Requires:

    1. A ConnectionFactory with
    Code:
    publisher-returns="true"
    2. Only one ReturnCallback can be registered with each RabbitTemplate
    3. Also need to setMandatory(true) / setImmediate(true) on the template.

    We need to add this information to the reference guide I've opened a JIRA issue for that... https://jira.springsource.org/browse/AMQP-240

    Comment


    • #3
      Hi Gary,

      Thanks for the quick and detailed response. I see it on the APIs but there seems to be no schema support. Is this the case at this point?

      Thanks,


      nicolas.loriente
      Last edited by nicolas.loriente; Jun 1st, 2012, 11:05 PM.

      Comment


      • #4
        ??

        This is on the template element in the 1.1 schema...

        Code:
        <xsd:attribute name="return-callback" type="xsd:string" use="optional">
        	<xsd:annotation>
        		<xsd:documentation><![CDATA[
        A reference to an implementation of RabbitTemplate.ReturnCallback - invoked if
        a return is received for a message published with mandatory or immediate set
        that couldn't be delivered according to the semantics of those options.
        		]]></xsd:documentation>
        		<xsd:appinfo>
        			<tool:annotation kind="ref">
        				<tool:expected-type type="org.springframework.amqp.core.RabbitTemplate.ReturnCallback" />
        			</tool:annotation>
        		</xsd:appinfo>
        	</xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="confirm-callback" type="xsd:string" use="optional">
        	<xsd:annotation>
        		<xsd:documentation><![CDATA[
        A reference to an implementation of RabbitTemplate.ConfirmCallback - invoked if
        a confirm (ack or nack) return is received for a published message.
        Requires a 'connection-factory' that has 'publisher-confirms' set to 'true'.
        		]]></xsd:documentation>
        		<xsd:appinfo>
        			<tool:annotation kind="ref">
        				<tool:expected-type type="org.springframework.amqp.core.RabbitTemplate.ConfirmCallback" />
        			</tool:annotation>
        		</xsd:appinfo>
        	</xsd:annotation>
        </xsd:attribute>

        Comment


        • #5
          Hi Gary,

          Yes, you are right... I see it on the distribution. I had only checked to see if it was posted here http://www.springframework.org/schema/rabbit.

          Thanks,

          Nick.

          Comment


          • #6
            Thanks; I see the 1.1 schema is missing from the site; sorry about that; I will fix it now.

            Comment

            Working...
            X