Functional replacement of springboot routing/mapping to camel endpoints in OSGI - apache-camel

Spring boot offers the capability to develop interactive web apps using websockets communication with a browser based client (JavaScript UI). The stomp protocol is used on websockets and then mapped to activemq queues or topics, allowing server side components to interact with a web client through the queues or topics and not through websockets. See spring boot page: https://spring.io/guides/gs/messaging-stomp-websocket/ for details. Normal JMS queues/topics on the server side are mapped to ‘N’ number of user specific websocket endpoints (see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-message-flow
).
Camel seems to have all the necessary components to achieve the same thing:
• AHC-WS – Camel websocket client
• Atmosphere-websocket - websocket server
• Websocket - websocket client/server
• Stomp - talks stomp to activemq broker
but has nothing prebuilt and that handles the mappings between user stomp/websocket sessions and individual server side topics and queues.
We are running in an OSGI container and need to duplicate the spring boot websocket (i.e. org.springframework.web.socket.messaging.*) capability but without spring due to the difficulties of supporting Springboot in OSGI. Can anyone suggest an existing example project or strategy to achieve this goal? This is a migration of an existing project and we must continue to support stomp on the websocket side.

Related

Using AWS Lambda to watch SNS topic and deliver by websocket?

For testing/debugging purposes, I would create a web app that emulates the functionality of one of the 3rd party actors in our system. It should be able to publish and subscribe to messages sent on the AWS SNS service.
I was planning to make a ReactJS web app that calls an API made in AWS Lambda. Sending messages should be fine, with some buttons in the app, calling a Lambda that publishes SNS messages to a topic.
But what about monitoring the messages sent to the relevant topics that I want to watch? I was thinking about using a websocket that could receive messages. I know I can trigger a Lambda with SNS messages, but how do I make the lambda deliver these messages to the websocket? is that possible at all without having a permanent server session running? Should I combine with other things in the AWS toolbox?
When I originally wrote this answer websocket support for Lambda was not available, but it is now: https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/
I was also looking for exact same thing but unfortunately aws sns doesn't have websocket support.
But I came across a very interesting blog. So what he has done is using AWS IoT which supports websockets and pub-sub. You can take a look here
Edit :
AWS API Gateway gives the functionality to manage Websockets in serverless way. Here is a quick starter guide API Gateway Websockets

How can we user NserviceBus with WcfRest using SqlServerTransport?

I want to create a WCF Rest Application using NserviceBus and also i want use SQLServer transport.
Kindly help me ..Give me some Proper Code
NServiceBus V5.x - SQL Transport V2.x
The following sample shows you how to setup the SQL transport:
https://github.com/Particular/docs.particular.net/tree/master/samples/sqltransport-nhpersistence/Version_2.2
Hosting in IIS
NServiceBus can be hosted in IIS without any issues. Especially with a central broker transport like SQL, RabbitMQ, Azure Storage Queues or Azure Service Bus.
http://docs.particular.net/nservicebus/hosting/#self-hosting-web-hosting
NServiceBus can be hosted in any web technology that support .NET. This includes:
ASP.net
ASP.MVC
WCF
Web API
NancyFX
And many others.
As most web technologies operate in a scale out manner NServiceBus is usually hosted in a "Send-only" manner. In this mode they act as a "forwarder" of messages rather than the "processor". So the handling code (MVC controller, NancyFX module etc) of a given web request simply leverages the Bus send APIs and no processing is done in the web process.
Hosting in IIS does have some concerns as application pools by default don't startup automatically and can be recycled or even stopped. Any messages send to such an IIS hosted endpoint will not be processed until the application pool is started again.
MVC
The following samples demonstrate how to initialize NServiceBus and how to use it from MVC
http://docs.particular.net/samples/web/asp-mvc-application/
http://docs.particular.net/samples/web/asp-mvc-injecting-bus/

how do I use Artemis with Camel Java DSL using the camel-jms component?

Right now I'm using JMS 2.0 with Artemis 1.2.0 on a Java EE 7 application and I would like to do some integration tasks with Camel.
Right now checking the camel-jms documentation, there is no mention whatsoever on how to use the generic camel JMS component to produce and consume messages to any JMS 2.0 compliant broker.
The only example on the component documentation is configuring an ActiveMQ connection factory with its specialized ActiveMQ component using the Spring DSL. How can I configure a connection for Camel JMS to connect to my Artemis instance?
Take into account that even though Artemis is compatible with ActiveMQ 5.x, I'm going to use a Camel route to publish and subscribe to shared durable topics, so I need to be able to configure an Artemis connection and do a publisher and a shared durable subscriber with it (only supported in JMS 2.0, ActiveMQ only supports JMS 1.1).
Thanks!
In the end I just created an Artemis connection factory and I'm using camel-sjms, for JMS 2.0 features at the moment I just go straight to JMS 2.0 producers as a camel components, and for consumers I use the latest Spring Messaging which uses JMS 2.0
I hope that in the future, the camel-sjms module is updated for JMS 2.0 and that way I just use vanilla Camel instead of having to work around through custom components.

Apache Camel - Backbone of IT infrastructure?

I have a bunch of web services. These services are written in different languages and expose a REST api. A front end web site accesses these services. The requests are proxied through a nginx server which does load balancing and connection management. This has been rock solid and very performant.
I'm contemplating replacing nginx with Apache Camel to take advantage of its powerful mediation and integration patterns. I have a few questions since I'm completely new to the Java ecosystem.
How performant is Apache Camel? Would the req/sec of a jetty end point be comparable to nginx?
Spring looks confusing. Can a standalone Camel application be deployed to something like AWS Elastic Beanstalk? If I want allow Camel to process more requests/sec, do I just add another Camel server in tandem?
Are there any pitfalls to using Apache Camel as the backbone to my entire IT infrastructure?
You have not mentioned what the major motivation is for changing the current architecture. Here are my comments:
How performant is Apache Camel? Would the req/sec of a jetty end point
be comparable to nginx?
I doubt if you will get the same req/sec performance from camel jetty as you do with nginx. Please dont take my word and try a load yourself with both the setup. I feel the message/exchange handling by camel will incur some cost that is missing form nginx. But both have different uses.
If I want allow Camel to process more requests/sec, do I just add
another Camel server in tandem.
This question is confusing. I assume your requests passed through one nginx. If you add multiple camel servers you need the sender to be available of the multiple camel servers or use some routing or load balancing mechanism in front of it that is aware of multiple camel instances.
Are there any pitfalls to using Apache Camel as the backbone to my
entire IT infrastructure?
This depends on what your problems are and how much of it is resolved by camel. Camel is an integration framework that supports multiple protocols. I see you only have web services which is supported by camel. But your current infrastructure already supports it.

Can I use Apache Camel with Jax-ws implementation in application server (e. WAS, WLS) without CXF or Axis2?

I dont want to use Axis2 or CXF with Camel. Is it possible to configure camel with JAX-WS reference implementation or weblogic application server or websphere application server or tomcat + jax-ws refrence implementation?
Camel provides 2 web services components out of the box: camel-cxf and camel-spring-ws. For any other web service integration just use plain java. From any Java code, you can send a message to Camel using the ProducerTemplate. Then that way you can bridge the JAX-WS of the application server with Camel. We used to have an old example at Apache Camel that showed how to integrate Axis 1.4 with Camel, but that examples has been removed as part of cleanup recently.
As far as I know that is not possible. The camel-axis and camel-cxf components are directly using the cxf and axis classes. You could use the SoapDataFormat but this is just for simple cases and not a full stack.

Resources