Giter VIP home page Giter VIP logo

spring-amqp's Issues

NullPointerException in Message.toString() method when BasicProperties are sent as null [AMQP-38]

Andrey Paramonov opened AMQP-38 and commented

I send a message using RabbitMQ Java client - com.rabbitmq.client.Channel#basicPublish(String, String, BasicProperties, byte[]) - with null BasicProperties, which seems to be a valid case. I get NPE when I try to print the message within the MessageListener implementation:

java.lang.NullPointerException
	at org.springframework.amqp.core.Message.getBodyContentAsString(Message.java:70)
	at org.springframework.amqp.core.Message.toString(Message.java:56)
	at java.lang.String.valueOf(String.java:2826)
	at java.lang.StringBuilder.append(StringBuilder.java:115)
	at com.ndpar.spring.rabbitmq.MessageHandler.onMessage(MessageHandler.java:14)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:316)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:254)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:230)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:199)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.processMessage(SimpleMessageListenerContainer.java:229)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:288)
	at java.lang.Thread.run(Thread.java:637)

Affects: 1.0.0.M1

Define a MessageFactory for configuration of common "default" MessageProperties values [AMQP-42]

Mark Fisher opened AMQP-42 and commented

This will be used by MessageConverters, RabbitTemplate, etc.

We should follow this fallback logic:

  1. explicit 'messageFactory' property has been set (e.g. on a RabbitTemplate)
  2. lookup by bean name (or possibly a single 'primary' bean even if others)

For #2, RabbitTemplate (and other users) would need to be BeanFactoryAware.

We need to decide what "default" properties make sense (e.g. persistent?)

Internally it might use MessageBuilder (see #1605).


Issue Links:

  • #1605 Provide a MessageBuilder with "fluent API" methods

Add AmqpAdmin interface in spring-amqp-core interface with RabbitAdmin implementation in spring-rabbit [AMQP-6]

Mark Fisher opened AMQP-6 and commented

This will require generic return types as opposed to the implementation specific DeclareOk objects.

For example, when declaring a Queue with an explicit name, we can have a void return type (else throw an Exception), and when declaring a Queue with a generated name, we should return a String (the generated name).


This issue is a sub-task of #1569

implement SingleConnectionFactory [AMQP-2]

Mark Fisher opened AMQP-2 and commented

For the milestone 1 release, the SingleConnectionFactory should be the default implementation of the ConnectionFactory interface.

Although we had originally planned on using the CachingConnectionFactory as the default, further work is necessary to provide a correct and robust implementation that caches Channels. There are many factors to consider in terms of 1) state that is maintained on a Channel corresponding to its use for acknowledgment of received messages, etc. and 2) volatility of the Connection itself due to certain Channel-related errors cascading to Connection-closing situations. We will explore these in more detail for future milestones.


No further details from AMQP-2

Provide consistent configuration and usage of vhosts in RabbitBrokerAdmin [AMQP-8]

Mark Fisher opened AMQP-8 and commented

Would be nice to configure RabbitBrokerAdmin using Spring's ConnectionFactory interface. The vhost from Rabbit's connection factory needs to be extracted and passed into the various jinterface API calls.

for example in RabbitBrokerAdmin

public Map<String, Map<String, String>> getQueueInfo() {
// TODO: pass virtual host... currently hardcoded to default ("/").. need to parse off connection string.
return (Map<String, Map<String, String>>) erlangTemplate.executeAndConvertRpc("rabbit_amqqueue", "info_all", "/".getBytes());
}


No further details from AMQP-8

remove the 'passive' property on the AMQP Queue object [AMQP-4]

Mark Fisher opened AMQP-4 and commented

This should ideally be handled as a boolean flag on the components that declare Queues. For example, the AmqpTemplate could have a 'shouldCreateQueueIfNotAvailable' flag. Of course, we might come up with a better, more succinct name than that (suggestions?), and/or we might decide to be negative instead of positive, such as 'shouldFailIfQueueDoesNotExist'.

For naming purposes, we should probably compare to some other similar create-if-not-existing scenarios in Spring.


No further details from AMQP-4

hostname property is ignored in ConnectionFactory implementations [AMQP-24]

Mark Fisher opened AMQP-24 and commented

We should set the hostname directly on the target ConnectionFactory rather than storing it in an instance variable (it is currently never being used!).

Also, we should replace the constructor that takes both targetConnectionFactory and hostname so that it only takes the targetConnectionFactory. That target should already have its hostname set anyways.

Finally, the getHostName() method can simply return the targetConnectionFactory.getHost() value.


No further details from AMQP-24

Move the declaration of queues, exchanges, and bindings into AmqpAdmin [AMQP-46]

Mark Fisher opened AMQP-46 and commented

This code is currently in the abstract @Configuration support class.

We should be able to follow the same approach in AmqpAdmin: it can implement SmartLifecycle with autoStartup set to true... and perhaps determined by a boolean flag (which should be 'true' by default), it will declare all Exchange, Queue, and Binding instances that it finds in the context.

This will only work for the case that all these components are being defined within the same virtual host (basically, they are declared on a Channel returned from a Connection returned from the AmqpAdmin ConnectionFactory, so that is the limitation). Using AmqpAdmin directly (and setting the boolean flag to false) is a perfectly valid option for those cases. We might want to explore some other ideas in the future (like nesting the resources within an outer tag that provides the connection-factory to use for that set).


Issue Links:

  • #1595 Add a boolean flag to SimpleMessageListenerContainer for declaring queues upon initialization
    ("supersedes")

Move Exchange, Queue, and Binding declarations into a post-configuration callback [AMQP-12]

Mark Fisher opened AMQP-12 and commented

The base @Configuration classes can define "queue()" and "exchange()" rather than "declareQueue()" and "declareExchange()". The declarations should happen in a callback upon startup so that in case of a fail-fast configuration error, the Exchanges and Queues will not be declared.

The AbstractRabbitConfiguration class can define an inner class (and return it as a bean) that implements ApplicationListener<ContextRefreshedEvent> then grab the Exchange and Queue beans from the ApplicationContext then declare them. The Queues must be declared before the bindings are created.


No further details from AMQP-12

remove "default" from template property names for exchange, queue, and routing-key [AMQP-9]

Mark Fisher opened AMQP-9 and commented

We should clarify in the javadoc for methods that accept "exchangeName" or "queueName" that those override the corresponding properties of the template itself. This is different terminology than we use in JmsTemplate, etc. where instead we refer to the default properties ("defaultDestination" or "defaultDestinationName"). This apparent break with consistency is justified however since the AMQP specification describes "default exchange" as the no-name exchange that always exist, and that is actually the default exchange property for our template.


No further details from AMQP-9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.