spring-projects / spring-projects/spring-integration
Add JMX inbound gateway [INT-3179]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 1.2k
- Avg merge
- 17h 48m
- Merged PRs (30d)
- 62
Description
Ilya Kazakevich opened INT-3179 and commented
Discussion from old Spring Forum:
Hello,
I have gateway with method that accepts some string. It is declared as interface and I use <int:gateway for it.
Now I want support team to be able to run this method via JMX (and send send message to my SI infrastructure this way).JMX exporter does not see my gateway because it is proxy. (<int:gateway creates proxy).
When trying to export it directly I got error saying JMX exporter does not accept JDK proxies.
I tried to use CGLIB, but how can I say to int:gateway it should use CGLIB proxy?
I can't configure the whole spring AOP to use CGLIB (it will break some other modules on the system).How can I export SI gateway via JMX?
It's not currently possible to expose <gateway/> methods with JMX; and there is no way to have the gateway use CGLIB instead of a JDK proxy.
One simple work around would be to write an implementation of the service-interface that simply delegates to the gateway, and expose your bean as an MBean.
@ManagedResource public class DelegatingMBean implements Gateway { @Autowired @Qualifier("gw") private Gateway gateway; @ManagedOperation public String send(String foo) { return this.gateway.send(foo); } }
Thank you.
I've finally solved an issue by creating a class that accepts MessageChannel and MBeanServer, creates MBeanInfo, accepts data and sends it to appropriate channel.
Now I can export any channel with primitives and strings to JMX by declaring bean for this class in xml config.
It would be cool to have such class in SI custom xml namespace.
Our support team needs to send some messages to channels in our application, based on spring integration.
The idea is to create such gateways declaratively.
I've attached file that solves this issue, but I think Spring should have some tag in it's namespace.
<int-jmx:inbound-gateway channel="customerNamesToDelete" server="myMbeanServer" paramDescription="Customer name" operation="Delete customer"/>
Attachments:
- ChannelJmxExporter.java (3.10 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached ChannelJmxExporter.java and the proposed int-jmx:inbound-gateway declaration. Compare its channel, server, parameter-description, and operation requirements with the project's existing JMX integration. Done means the requested gateway can be declared in the namespace and send messages to the named channel through JMX.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100