microsoft / azure-spring-boot

Spring Boot Starters for Azure services
MIT License
374 stars 460 forks source link

create service bus object with @Autowire #829

Closed marcoboffi closed 4 years ago

marcoboffi commented 4 years ago

Environment

Summary

Queue/Topic/Subscription objects must be created before you use them. See also azure servicebus spring boot starter guide.

Reproduce steps

Expected Results

It would be very useful if Autowired directive can create service bus objects (Topics,Queues,Subscriptions) if they don't exist.

Actual Results

superrdean commented 4 years ago

Thanks for your proposal, but I am a little confused about your expected results part. In current codes, it will create these objects automatically if you config the specific properties, you only need to @Autowire them if you need to use it. There is an example: https://github.com/microsoft/azure-spring-boot/tree/master/azure-spring-boot-samples/azure-servicebus-spring-boot-sample

marcoboffi commented 4 years ago

On example you referred, point 3 of section ["Create Service Bus on Azure"] (https://github.com/microsoft/azure-spring-boot/tree/master/azure-spring-boot-samples/azure-servicebus-spring-boot-sample#create-service-bus-on-azure), says to create queue and topic from portal before and then copy object names on application.properties.

superrdean commented 4 years ago

I think I get your point, but it may cause some other problems, for example, if you run some test codes, then some useless queues or topics will be created in your service-bus resource, it seems not good. But maybe we can provide a property to control the automatically creating for queues and topics like auto.create=true/false. We need to do some investigation and discuss its feasibility, then give you a response. Thanks for your proposal!

marcoboffi commented 4 years ago

Thanks a lot for your effort. It's great for us if behaviour and features are as similar as possible to RabbitMQ and configurable by autowired (object constructor, connection timeout, client retry,handlers, etc)

saragluna commented 4 years ago

Closing this issue.

We've deprecated the Service Bus starter in this repo, and you could use our Spring Cloud Stream Binder implementation instead, check it out here https://github.com/microsoft/spring-cloud-azure/tree/master/spring-cloud-azure-stream-binder. And I remember the resources will be created there if an Azure subscription is provided.