Is it possible to change from endpoint in dynamic way ?
for example I want change
for(endpointFirst).routeId(ROUTEID).to(finishEndpoint);
to
for(endpointSecond).routeId(ROUTEID).to(finishEndpoint);
I try use
camelContext.stopRoute(TestRoute.ROUTEID);
change old endpoint to new endpoint
camelContext.startRoute(TestRoute.ROUTEID);
but my efforts not work properly.
thanks for any help
You would need to
stop the route
remove the route
change the endpoint
add the route
start the route
This allows you to change the from endpoint to whatever you want (for example something else)
Some components / endpoint do allow to change options an have those being updated at runtime. For example the JMS endpoint allows this, so you can
stop the route
change an option on the jms endpoint
start the route
But there may be some components which cannot do that.
to change the from endpoint, you can just dynamically add/remove routes via the context APIs or alter the route as Claus suggested
to change destination endpoints, use the recipient list EIP and an Expression to dynamically determine the endpoint based on message headers, variables, methods, etc...
from("direct:a")
.recipientList(header("foo"));
Related
I am confused as to what are the elements that are considered necessary to retrieve data for users from an exposed Endpoint like (http://localhost/users/).
Is it http:listener-endpoint or http:listener-config or both?
The thing you're asking is explained in Mule docs
You need both - http connector and its configuration. To listen http://localhost/users/ just specify 'users' in http connector path.
I want to customise the Action and ReplyAction properties of the OperationContractAttributes that I have on my data contract types in my WCF services.
I have some logic in an ESB that will read incoming messages and route them accordingly based on the SOAP action header so I need to explicitly state the values for these properties. But I don't even look at messages being returned, so it seems cleaner to have the same value for both properties.
I'd like to know if there is anything obviously wrong with setting these two properties to equal the same value for a specific operation? Why are the default values different to one another?
Thanks
Just to follow up on my own question in case it's helpful to others... I did proceed with using the same value for Action and ReplyAction.
Many SOAP implementations ignore the actions so it's less relevant, but WCF does use this value to route a message to the operation on a service. Setting both of the values to the same thing doesn't cause any issues because no system processes both the request and the response so there's nothing ambiguous about it.
I found that doing this made the WSDL generated simpler to understand, and there were half as many actions to document and route in our ESB.
I am building a routing slip bean and want to apart from the dynamic routing also to send a parameter to the endpoints of the recipients list.
I wish to use something like "direct:test?param=value", where param and value are set inside the routing slip POJO
From what I understand from the direct component, a single "direct:test" endpoint will receive all the routed exchanges, however I need a way to read the param send from the routing slip
How can I use this param to the endpoint which receives the exchange? Is it a property of the exchange?
Pan,
I'd use the header functionality of camel. It's quite versatile and you can handle it using predicates for some nice DSL or spring control, or in a bean/processor by doing myExchange.getIn().getHeader("foo").
I created a Workflow Foundation workflow which will eventually invoke another Workflow Service. I added the call to this service by dragging the appropriate shape from the toolbox onto the designer. The shape was available because I added the Workflow Service as a service reference as recommended.
How can I specify a specific endpoint address for this web service? I can't find a way to programmatically specify the address.
The workflow always uses the address specified in the web.config. But based on certain conditions I want to use different addresses.
Edit
Here is a picture I created to illustrate the problem:
Look for the place where you make a call to the Workflow Service. Somewhere there you define a client. It should look something like this:
client.InvokeService(); // or whatever method you call;
If you want to change address you should change endpoint address before this call, ideally when you define the client:
client.ChannelFactory.Endpoint.Address = new EndpointAddress("http://something.com/service.wsdl");
But keep in mind that this is not recommended practice. If you intend to change it programmatically it's better to get rid of services section in your web.config completely and set properties programmatically when creating client.
When you add a service reference it creates the class "MyServiceClient" with a default constructor. If I use new MyServiceClient() I get an error: Could not find default endpoint... If I use new MyServiceClient("endpointName") it works.
I would like to specify a default endpoint in app/web.config which will get used when I use the default constructor. I know I can place that default name in *.settings and use it throughout my app, but just wondering if there is any built-in way to do it.
If you have only a single endpoint in your client's app.config, then that one endpoint will be used.
If yuo have multiple endpoints in your client's app.config, you must define which one to use. There's no mechanism or feature in WCF do designate one as the "default" endpoint - and I haven't heard anything about WCF 4 adding any such feature, either.
So if you want to have a default endpoint, then yes, you'll have to store the name of the endpoint in your app.config as well and programmatically retrieve that name before instantiating the endpoint.