I want to intercept message send by a mqtt client to artemis broker.
I am following the example "interceptor-client-mqtt".
My problem is that I am always getting an error "java.lang.ClassNotFoundException: SimpleMQTTInterceptor".
My question is where should I put the interceptor class so that the broker could find it?
Should I put only the class of the interceptor, or should I put a jar file?
Put your interceptor class in a jar in the broker's "lib" directory.
Related
firebase:
how to get remote config information via HTTP in the form of a JSON request, without modules?
enter image description here
Firebase Remote Config provides REST endpoints you can use to get your project's remote config. See https://firebase.google.com/docs/reference/remote-config/rest
I'm using the Camel SMTP component to send email messages from a Camel route, and it works fine, but I get two warning messages every time I send a mail.
expected resource not found: /META-INF/javamail.default.providers
expected resource not found: /META-INF/javamail.default.address.map
Is there a way of stopping this? I've tried putting blank resource files in the META-INF folder of the route's jar file, but that doesn't appear to have any effect. Apparently JavaMail tries to find these files in various places on the classpath, and default files should be in the JavaMail jar file, but for some reason, this isn't being picked up in the OSGi environment from which I'm running these routes.
The OSGi (Karaf) console lists bundles
JavaMail API v1.6.1
camel-mail 2.21.2
Can anyone tell me what I am missing here?
Thanks!
I tried a few solutions given at https://javaee.github.io/javamail/docs/api/index.html?javax/mail/Session.html. I use eclipse photon 4.8.0. The only thing what worked is to place an empty file named javamail.default.address.map into the folder src/main/java/META-INF. Alternative you can place it into the folder src/main/resources/META-INF, when you change the exclusion-pattern in eclipse-project to (none). Now everything works fine without the annoying warning.
I have an application which uses camel-jetty, camel-cxf to expose a REST api and runs in apache karaf (fuse esb). Because of security reasons, I need to remove 'Server' header from API response. I removed the header from camel exchange headers but still it returns in api response as Jetty(7.6.7.v20120910). How can I remove the header from API response ?
The jetty component, you can turn off sendServerVersion by setting sendServerVersion=false in the endpoint uri.
For Apache CXF or camel-cxf I am not sure if that is possible. You would need to check Apache CXF documentation.
I added following line to jetty.xml and got server header removed.
<Set name="sendServerVersion">false</Set>
I am new to camel so my question is how to get request and responce values that is displayed on saop UI to the log file using Interceptors configuration. I need to apply some interceptor configuration before the request hit to camel so that we can filter the request object and same with the responce.
Look at logging interceptors in camel cxf endpoint declaration : inInterceptors
http://camel.apache.org/cxf.html
Or
You can just print the request inside your route as well using ${body}
Add this to your route configuration:
interceptFrom()
.when(exchange -> isToBeIntercepted(exchange)) //which routes are to be intercepted
.process(doSomeStuffHere());
To disable HTTP connection persistency I would like to enforce HTTP protocol 1.0 on one of my Apache Camel routes using the http component.
Following Camel's http component documentation I tried to use the following URI:
http://localhost:8888/foo?httpClient.protocolVersion=HTTP/1.0
However, the camel context initialization fails with a ResolveEndpointFailedException with message:
Unknown parameters=[{protocolVersion=HTTP/1.0}]
I assumed that the protocol version parameter is available due to the HttpClientParam documentation. Interestingly, the soTimeout example from the Apache Camel documentation works fine.
I tried both the http and http4 components. I use Apache Camel 2.10.4. The http component has the user agent Jakarta Commons-HttpClient/3.1.
I know that I could also try to use the httpClientConfigurer and/or clientConnectionManager parameters of the http components, but would rather use a solution that does not require custom code.
Thanks in advance for any help!
I came up with the following solution.
On the http-component URL I set a custom httpClientConfigurer:
http://localhost:8080/foo?httpClientConfigurer=myHttpClientConfigurer
where myHttpClientConfigureris a bean with an implementation similar to this:
public class Http10ClientConfigurer implements HttpClientConfigurer {
#Override
public void configureHttpClient(HttpClient httpClient) {
if (httpClient.getParams() != null) {
httpClient.getParams().setVersion(new HttpVersion(1, 0));
} else {
// Could not set HTTP 1.0 version on httpClient
}
}
}