In the past I have been able to apply advice chain handlers on different outbound channel adapters. I am trying to do the same on int-aws:s3-outbound-channel-adapter but its not allowing that. Does this component not allows this behavior. Basically I am interested in finding out when the adapter completes the upload of a file to S3.
<int-aws:s3-outbound-channel-adapter
id="s3-outbound" channel="files" bucket="${s3.bucket}"
multipart-upload-threshold="5192" remote-directory="${s3.remote.dir}"
accessKey="${accessKey}" secretKey="${secretKey}">
THIS DOESNT WORKS - throws an error !!!
<int:request-handler-advice-chain>
</int:request-handler-advice-chain>
</int-aws:s3-outbound-channel-adapter>
Right, that isn't allowed by the XSD. Feel free to raise a JIRA on the matter.
But that doesn't matter that it doesn't work at all.
If you are on Spring Integration 4.x already you can move that <int-aws:s3-outbound-channel-adapter> to the Java & Annotation configuration using #Bean and #ServiceActivator for the AmazonS3MessageHandler.
Where #ServiceActivator has adviceChain attribute to specify bean references to your Advices.
... or you can do that using generic <int:outbound-channel-adapter> and specify AmazonS3MessageHandler as raw <bean> for the ref of the first one.
HTH
Related
in spring-integretion project,i have a hot folder that detects when a csv is placed in a folder and do some extra stuff, i have a inbound-channel-adapter connected with a channel.
inbound-channel-adapter -> channel.
detects when a csv its placed receive the mns its connected with
a service-activator
what i what to do its test only that the channel its receiving the mns when a file its created
i am using this tutorial
https://www.javacodegeeks.com/2013/05/spring-integration-file-polling-and-tests.html
its very useful, but i can create the context
Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener#57a4d5ee] to prepare test instance [proyect.integration.hotFolderTest#5af5def9]
java.lang.IllegalStateException: Failed to load ApplicationContext
You need to show more stack trace on the matter, because right now it isn't clear what is your real issue.
Also would be great to share some code what you have so far and what you would like to do in the test case.
To verify a message presence in the channel you can configure a ChannelInterceptor and implement its preSend().
However we also suggest something like #SpringIntegrationTest with the MockIntegration features. That way you can replace your real service activator with some MockIntegration.mockMessageHandler() and perform verification on it.
You would need to configure a noAutoStartup on the mentioned annotation do not poll directory until you prepare your mock and call a this.mockIntegrationContext.substituteMessageHandlerFor().
See more info in the Reference Manual: https://docs.spring.io/spring-integration/docs/current/reference/html/testing.html#test-context
I have a requirement in hand where I need to change the Mule Flow Threading Behavior at runtime without the need of bouncing the whole Mule Container. I figured out few different ways to achieve this, but none of them are working.
I tried accessing the Mule Context Registry and from there I was trying to do a lookup of "FlowConstructLifecycleManager" Object so that I can tap in there and access the threading profile of the object and reset those values, then stop and start the flow programmatically in order to get the change applied in the flow. I am stuck in this approach as I was unable to get hold of the FlowConstructLifecycleManager Object neither from the Mule Spring Registry nor from the Transient Registry. I was able to get hold of the Flow object though which has a direct reference to that FlowConstructLifecycleManager Object. But, unfortunately, they made this object as protected and didn't expose any method for us to access this object.
Since I was unable to access this FlowConstructLifecycleManager directly from Mule implemented Flow class, I decided to extend this Flow class and just add another public method to it so that I can access FlowConstructLifecycleManager object from Flow object programmatically. But, I am stuck in this approach as well as even if I am putting my version of the same Flow class packaged and dropped in lib/user folder of the container, it is still not picking up my version of the class, and loading the original version instead.
It would be of great help if I can get any pointer on the approach of solving either my first or second problem.
Thanks in advance,
Ananya
In our company, we are building a dashboard from where we should be able to start/stop any flow or change the processing power of any flow by increasing/ decreasing the active threads for a flow or changing the pollen polling frequency. All of these should be done at runtime without any server downtime.
Anyway, I made it working finally. I had to patch up the mule-core jar and expose few objects so that I can get to the thread profile object and tweak the values at runtime and stop/ start the flow to reflect the changes to take effect. I know this is little bit messy and but it works.
Thanks,
Ananya
Hi I am working with Mule Web Service Consumer and i was trying to call operation with Multiple Parameters it is warning me that
Warning : Operation Messages With More then 1 Part Are Not Supported
I just want to pass multiple parameters to access my SOAP method to achieve the task.
Is this the problem with Web Service Consumer or is their any way to deal with this.
I'm afraid this is a known limitation of the web services consumer. However you can accomplish this with the cxf component.
I having the same issue and found some information around it ...
There is a improvement logged in JIRA, may help if you vote for it :)
This link suggests that you can still use WSConsumer but need to do some hand crafting of the request XML ... I could not understand what that exactly it meant so if anyone has an example on it would be great
PS: The problem I had with using CXF component is that it does not play well with the new Dataweave transformer as the Dataweave needs to be placed within the response block and from there it cannot datasense the response coming out from the CXF component
The Solution here is very simple. You just have to comment other messages and then load metadata for non-commented message (for one which you're trying to load metadata). Repeat this procedure for all the other messages and you're good to go.
Hope this helps !
I have a flow with two VM endpoints both configured with the exchange pattern of request/response. I want to evaluate the message at the end of the flow when it reaches the seecond VM endpoint, before the next flow takes off with the message. I thought I might be able to do this with an interceptor inserted before the VM endpoint. Is this possible from within a Mule FunctionalTestCase? Is it possible to programatically add an interceptor to a flow at all..?
Personally, I think that the flows should not really be altered during the testings. In that case you would have another (although just slightly different) version running when you deploy it to a server.
Instead, I would argue that you divide your flows into testable parts and put the endpoint addresses into separate configuration. That way you can test each vm-based flow separated from each other and verify the behaviour using mock flows or similar.
vm://in-flow1 -> process -> vm://mock
vm://mock -> verify payload -> vm://in-flow2
In the "real" configuration, you change "mock" to something pointing to the second vm flow.
You can also elaborate on mocking the first or second VM flows entirely from each other to create distinct unit tests.
However, if you really want to go down the "modify code for testing purposes" rabbit hole, you can likely use some aspect oriented black magic to achieve that.
Look at this blogpost how it's done in mule.
You could try with Munit, and run an spy around the flow (it should work). So you can run assertions after the flow execution
https://github.com/mulesoft/munit
I'm trying to send a message to the WCF-WSHttp adapter with a dynamic
send port from an orchestration, but BizTalk seems to always be
reverting back to the HTTP Adapter.
According to the docs that I've been able to find, I should just need
to set the transport type from my expression shape to get BizTalk to
use the WCF-WSHttp adapter, and I AM, but it still seems to be
reverting. Below is an example of my expression shape that's setting
the properties (as you can see, I've tried both
Microsoft.XLANGs.BaseTypes.TransportType and
BTS.OutboundTransportType):
Body(BTS.OutboundTransportType) = "WCF-WSHttp";
SendMessagePort(Microsoft.XLANGs.BaseTypes.Address) =
System.String.Format("{0}/Accept{1}", "http://myserver/myservice/
myservice.svc/Accept{0}", messageInfo.MessageType);
SendMessagePort(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-
WSHttp";
Probably are Craig :-)
When using a dynamic send port, BizTalk uses the "scheme" part of the url to decide which adapter to use.
When your url starts with "Http://" or "Https://" BizTalk would always use the HTTP adapter.
Similarly url's begining with ftp:// will use the FTP adapter.
Same works for custom adapaters as well - when you install the adapter's configuration you register the moniker to use; for example - the open source Scheduled Task adapter uses schedule:// (I believe).
Using dynamic send ports with WCF is slightly more involved than most other adapaters because of the various configuration that's required but you can find detailed explanation here, just scroll down to the "Dynamic Send Ports" section about half way down.
I ended up resolving my issue, but am still unsure of the reasoning for the behavior I saw.
The Expression shape mentioned in the question was located inside of an Atomic Scope. Once the Orchestration exited the scope containing the Expression shape, the Transport Type was reset back to its original value. Moving the Expression out of the atomic scope resolved the issue, in that the TransportType was set correctly.