We have defined spring beans in Mule-config.xml. Certain public methods in this bean class needs to be periodically executed. We attempted to used spring quartz and spring task scheduler (adding beans in mule-config.xml)- but method is not executing in a schedule way - it is not triggered. Even using annotation (scheduled) does not work. Any work around for this? Any issue with spring scheduler with mule? Kindly help.
Thanks
If you want to use the Schedule annotation, take a look at this recent answer on the subject for a workaround.
Otherwise, Spring Quartz should work fine too. What have you tried? Share your config and specify the Mule version you're using. I'll review my answer accordingly.
Related
I am currently lost on the requirement to implement a SecurityManager interface in Java / Geode per Implementing Authentication.
Is there standard implementation that I can point to in gemfire.properties to handle the security-username and security-password properties?
I got as far as taking the ExampleSecurityManager java class and saving it to the Geode bin directory, and then trying to point the security-manager property to it.
security-manager=org.apache.geode.security.examples.ExampleSecurityManager
If I run Geode out of the box and do exactly that then the locator fails to start with org.apache.geode.security.GemFireSecurityException: Instance could not be obtained, java.lang.ClassNotFoundException: org.apache.geode.security.examples.ExampleSecurityManager
A crazy question. THANKS for your comment.
#JensD thanks once again. I requested to update the Javadoc but the Custom Security Manager page has it the right way around!
It should be org.apache.geode.examples.security.ExampleSecurityManager
when I use a #RepositoryEventHandler then its methods are only invoked when the call into the repository comes in via HTTP.
Any reason why? OK, it is called Spring Data REST, but wouldn't it be VERY useful to invoke the handler too, when I call my Repo directly, not via HTTP?
Any way to invoke the handler when called directly (some magic AOP-stuff)?
Thank you
The reason for that is that the different persistence mechanisms covered by the different Spring Data modules already ship with event mechanisms. Depending on the one you use you now get a different mechanism to use.
Unfortunately this can't be unified as e.g. with JPA not all persistence operations need to go through the repository in the first place, as JPA automatically flushes all changes that were made to an attached instance on EntityManager flush. In this case even AOP on the repository instance doesn't help.
So you're basically left with two choices:
The events exposed by Spring Data REST for all repositories (as we basically don't make use of the automatic change tracking in JPA).
The store specific event mechanisms that will make sure that the persistence mechanism exposes events as documented.
I don't know if the solution I put below from other stackoverflow questions would seen as acceptable by #Olivier-drotbohm, but from:
SpringDataRest #RepositoryEventHandler not running when Controller is added
and
#RepositoryEventHandler events stop with #RepositoryRestController
you could inject/autowire the "ApplicationEventPublisher" and fire the BeforeCreateEvent/AfterCreateEvent manually to trigger the RepositoryEventHandler.
This is not a perfect solution, but I hope it is good enough for you (and we tested it: it works).
I'm currently working with Spring AMQP version 1.3.6.RELEASE and Spring Retry 1.1.2.RELEASE. According to the Spring AMQP documentation section 3.3.1 one can add retry capabilities by passing in a RetryTemplate.
Are there any existing capabilities to provide a RecoveryCallback<T> implementation? I was reviewing the RabbitTemplate.java implementation and I couldn't find any.
The use case I'm considering is that if a *Send() execution fails because the broker is down I'd like to implement my own custom logic.
I understand that I could wrap the convertAndSend() call in my own RetryTemplate implementation and implement a try { ... } catch (AmqpException e) { ... } but I did not want to go down that road if Spring AMQP provided a cleaner implementation.
You are correct: there is no such an ability right now.
Feel free to raise a JIRA issue and we'll address it soon.
Thanks.
And I think you go right way with a workaround: you really just use your own RetryTemplate instance with raw RabbitTemplate.convertAndSend invocation in the doWithRetry inline implementation.
I'm attempting to define a spring bean using as below:
<lang:groovy id="mmmm" name="GroovyRssGeneralTestServer" script-source="${app.home}/groovy/RssGeneralTestServerImpl.groovy">
<lang:property name="xmlFile" value="${app.home}/rss/GeneralTestServer.xml" />
</lang:groovy>
I've tried several different locations for the script-source, but have had no luck in getting mule to find the source for the groovy script.
Second, I'm curious whether I can even wire up a groovy component to use this bean even if I do get it configured correctly above?
Why are you trying Spring bean when there is a Groovy component in Mule that can execute external Groovy script ? Please refer :- http://www.mulesoft.org/documentation/display/current/Groovy+Component+Reference
and this :-
http://groovy.codehaus.org/Dynamic+language+beans+in+Spring
Hope this help
I would like to be able to create some directories after Mule has started, but before it starts any other services.
I started looking into notifications but I'm not sure if that is the right place to do it. I will need access to the spring beans so it would have to be after spring init, but before any of the connectors and other processes kick off.
http://www.mulesource.org/display/MULE2USER/Mule+Server+Notifications
Thanks.
The mule lifecycle has several interfaces available that you could use to accomplish this.
http://www.mulesource.org/docs/site/2.2.1/apidocs/org/mule/api/lifecycle/Startable.html
.../Initialisable.html
Essentially, from what I understand, if you want something to happen when your mule instance starts you would implement startable. If you want something to happen when a specific mule component is initialized, then you would implement initialisable.
Also see http://blogs.mulesoft.org/start-me-oh-so-gently/
A really neat way of doing this is to create your own Custom Agent by implementing UMOAgent.
<!-- Enable Agents for Mule -->
<agents>
<!-- The MyAgent provides a convenient place to perform one off actions at startup/shutdown -->
<agent name="MyAgent" className="com.xxx.base.util.MyAgent" />
...
Agents have a start and Stop method which gets called by Mule, your implementing class can then add in any code you want.
See link for more info
http://www.mulesoft.org/documentation/display/MULE2USER/Mule+Agents