New to ServiceMix, I'm not sure if it can do what I need:
I've an interface defined by wsdl
I have several endpoints that implement that interface defined by the wsdl
I've a service that can only send the message to one endpoint.
Can service mix do the following:
Producer sends to an endpoint in servicemix (with the wsdl).
ServiceMix broadcasts to the different endpoints the message.
Thanks for the advice and / or pointers!
The simplest would be to use a Camel Recipient List. This would allow you to have either static or dynamic destinations for your broadcast.
It sounds as if your application doesn't require termination of the SOAP message (de/serialize the payload to/from an object) at the ServiceMix consumer. Therefore it can be kept very simple by using a Camel Jetty proxy:
There are further details on the link above on how to configure static (the example above) and dynamic routing.
If your application changes and does require termination of the SOAP message at the ServiceMix consumer in the future, then change out the Camel Jetty consumer endpoint with a Camel CXF endpoint and set bridgeEndpoint to false.
As for ServiceMix you will need to enable the Camel Jetty component. To have it enabled by default you need to edit the etc/org.apache.karaf.features.cfg file and add camel-jetty to the featuresBoot property. This is typically the best practice for features required by your application. You can also install the feature at the ServiceMix console with the command "features:install camel-jetty".
The Recipient List capability is part of the Camel Core API which is installed by default and if not, as a dependency of any other Camel component.
Best Regards,
Scott ES
Related
Let's suppose there is a link to a web-service, e.g. http://1.2.3.4:56789/ws_bla_bla_bla/some_service?WSDL
This address shows xml document, as I guess this is called Initial WSDL.
What is it? Just a list of possibe requests/responces pairs and their xml-structure?
WSDL describes the web service and used to generate client side class which you can used to communicate with service (proxy classes)
couple of generators
http://easywsdl.com/
http://www.wsdl2code.com/
SoapUI is another tool which you can used to test service based on WSDL.
I have been successfully evaluating Spring Cloud DataFlow with a typically simple flow: source | processor | sink.
For deployment there will be multiple sources feeding into this pipeline which I can do using data flow labels. All well and good.
Each source is a different rabbitmq instance and because the processor needs to know where the message came from (because it has to call back to the source system to get further information), the strategy I'd thought of was to enrich each message with header details about the source system which is then transparently passed along to the processor.
Now, I'm well-versed in Spring, Spring Boot and Spring Integration but I cannot find out how to enrich each message in a dataflow source component.
The source component is bound to an org.springframework.cloud.stream.app.rabbit.source.RabbitSourceConfiguration. The source uses the default Source.OUTPUT channel. How do I get hold of each message in the source to enrich it?
My processor component uses some Spring Integration DSL to do some of what it needs to do but then this processor component has both an INPUT and OUTPUT channel by definition. Not so with the RabbitSourceConfiguration source.
So, can this be done?
I think you need a custom MessageListener on the MessageListenerContainer in RabbitSourceConfiguration.
In the RabbitSourceConfiguration you can set a custom ChannelAwareMessageListener (You can possibly extend from MessagingMessageListenerAdapter as well) on the MessageListenerContainer that does what you incline to do.
In the end what worked was subclassing org.springframework.cloud.stream.app.rabbit.source.RabbitSourceConfiguration to:
override public SimpleMessageListenerContainer container() so that I could insert a custom health check before calling super.container(). My business logic enriches each message (see next bullet) with details of where the message came from (note, this is the publisher of the messages and not the rabbit queue). There's a health check needed to validate the additional enriching information (which is provided via configuration) to ensure that messages aren't consumed from the queue and enriched with the wrong information. If the validation fails, the source component fails to start and hence no messages are consumed.
override the creation of the AmqpInboundChannelAdapter bean so that a custom subclass of DefaultAmqpHeaderMapper can be set on the adapter. This custom mapper adds the enriched headers in public Map toHeadersFromRequest(final MessageProperties source).
For me, the inability of stream/dataflow to intercept and modify messages in Source components is problematic. I really shouldn't have to fiddle around with the underlying message broker API in the ways I did. I should be able to do it with e.g. Spring Integration. Indeed I can register a global message interceptor but I cannot change the headers of the message.
This ability would go on my WIBNI (wouldn't it be nice if) list. Perhaps I'll raise a request for this.
I have two separate services communicating using AmqpProxyFactoryBean (the "client") and AmqpInvokerServiceExporter (the "server"). Now, I'd like to include some custom headers on every request made through the AMQP proxy and be able to access them on the "server". Is there any easy way I can achieve this?
Since AmqpClientInterceptor uses AmqpTemplate to send and receive AMQP messages, you can provide for that RabbitTemplate any custom MessageConverter. And populate any additional headers from your toMessage() implementation.
However I'm not sure that you will be able to access to those custom header on the server side. We end up there just with RemoteInvocation.invoke().
So, seems for me you finally come up to the solution with an additional RPC param.
From other side that custom header may be useful for other AQMP routing scenarios when you can route that RPC message not only to the RPC queue.
Consider using Spring Integration AMQP Gateways instead of remoting over rabbitmq; that way you have complete control over the headers passed back and forth.
If you don't want to use Spring Integration, you can use the RabbitTemplate sendAndReceive methods on the client and either the receiveAndSend or a listener container on the server.
Again, this gives you full control over the headers.
Exist a container on the spring-amqp that support a reply-to feature?
I want make RPCs like https://www.rabbitmq.com/tutorials/tutorial-six-java.html, but using spring-amqp.
Yes. Documentation here.
On the server side, the message listener container, when used with a message listener adapter will automatically handle the replies. You can also use the template's ...receiveAndReply methods on the server side.
EDIT
Note that we now have Spring Boot implementations of all 6 tutorials.
I'm using Apache Wink to access a service, and trying to debug a problem where the server apparently does not recieve my request in the intended format (details below, but are probably immaterial). Is there a way I can make the Wink client to log the HTTP requests that it makes to the server, so that I can see what is being sent down the wire?
Details: I'm using Eclipse Lyo to create a ChangeRequest in RTC (rational team concert) using their OSLC v2 REST APIs.(Eclipse Lyo internally uses Apache Wink). In doing so, even though I've set a "Filed Against" property in the ChangeRequest being submitted, RTC does not recognize it and complains that it is missing.
I think it's better to use a proxy to monitor the traffic. If your client runs on Windows, Fiddler is a very nice tool.