Reading JBOSS system variable in CAMEL - jboss

Can someone explain how to read JBOSS system variables (e.g. jboss.bind.address) in CAMEL? We are using CAMEL as part of a web-service which talks to several other backend web-services and we want the piece of code that creates an endpoint to bind to a specific network interface. This information is

Well it should be working with
System.getProperty("jboss.bind.address");

Related

Suggestion or help needed for implementing stateless ejabberd architecture

I want to implement a real-time chat application. Technologies, database and OS used for this purpose:
Node.JS
Ejabberd as XMPP server
MySQL Database
React-Native (Front-End)
OS - Ubuntu 18.04
By far, I have achieved setting up ejabberd and registering the user and getting status from both the API and command line. For example, I can register a user from any other device/system and from the command line too. But the problem with this is that all the data gets stored in ejabberd database on the Ubuntu server due to which there are data duplication chances also I already have a database structured and defined and already have data in that.
In ejabberd tutorials, there is a part where they have mentioned stateless architecture where the ejabberd server manages XMPP part with our database (I didn't understand a lot about this stateless thing). So I need some help, example or tutorials where there is more understanding about the stateless architecture.
Already gone through below mentioned links -
https://blog.process-one.net/wp-content/uploads/2016/09/designing-a-modern-XMPP-service-with-ejabberd.pdf
https://www.youtube.com/watch?v=-dqQfCpw98E&feature=youtu.be&t=1m33s (Tutorial where Stateless is mentioned)
https://www.slideshare.net/mremond/xmpp-academy-2
https://docs.ejabberd.im/tutorials/ (Official tutorials about ejabberd)
Not-helpful links -
ejabberd stateless configuration
To configure stateless ejabberd, you need to configure your storage module to store the data using ReST API. Stateless ejabberd was designed for fluux.io service, but you can also implement it yourself using contributions or ejabberd API.
For example, for user based, you can rely on ejabberd_auth_http: https://github.com/processone/ejabberd-contrib/tree/master/ejabberd_auth_http

Exe as Webservice Endpoint

I got a webservice endpoint and I stumple upon how to correctly implement it.
It seems to be an parameterized exe-file which returns an XML Reply.
There is no documentation.
I am used to soap, wcf and rest but this is completely unknown to me, has anyone a guide or a best case how to implement such a service?
I can consume it with a HTTP GET but there are some questions left to me:
I know the questions are quite broad... But I could not find anything about it in the interwebz.
Is there a secure way to publish exe files as webservice?
Are there any critical downsides implementing such an interface?
Make I myself a fool and this is just an alias?
Example Url:
http://very.exhausting.company/Version/SuperStrange.exe?parameter=String
Web servers
What you call a webservice endpoint is nothing else than a web server listening on some host (normally 0.0.0.0) and some port on a physical or virtual machine and responding with some HTTP response to HTTP requests sent to that host, port and URIs that the web server cares to process.
Any web server is itself an application or a static or dynamic component of an application as the following examples illustrate:
JBoss, Glassfish, Tomcat etc. are applications, known as application servers, into which containers/servlets/plugins implementing web servers and corresponding endpoints are deployed. These listen on some port exposing generic web servers routing requests to those containers and their servlets;
a fat jar started with java -jar on a JVM which deploys a vert.x verticle featuring a vert.x HttpServer listening on some port is nothing else than a web server;
an interpreter such as node.js parsing and executing JavaScript code based on the express module will most likely deploy a web server on some port;
finally, a statically or dynamically linked application written in languages such as C++ or Go can expose a web server listing on some port.
All of the above cases feature different deployment mechanisms, but what they deploy is essentially the same: a piece of software that listens for HTTP requests on some port, executes some logic based on request and returns HTTP responses to the caller.
Your windows exe file is most likely a statically linked application that provides a web server.
Protocols
So we know you have a web server as it reacts to an HTTP GET. How does it relate to REST, SOAP etc? Effectively, REST, SOAP etc are higher level protocols. TCP is the low level, HTTP is based on top of that and your server supports that. REST, SOAP and everything else that you mention are higher level protocols that are based, among others, on HTTP. So all you know is that your application (web server) supports HTTP, but you do not know which higher level data exchange protocol it implements. It definitely implements some, at least a custom one that its author came up with to exchange data between a client and this application.
You can try to reverse engineer it, but it is not clear how would you find out about all possible endpoints, arguments, payload structures, accepted headers etc. Essentially, you have a web server publishing some sort of an API, but there is no generic way of telling what that API is.
Security
The world around you does not have to know how the API is published. You can put any of the above 4 web server implementations behind exactly the same firewall or a reverse proxy with SSL termination exposing just one host and port over SSL. So there is no difference in security, with respect to the world, whether you deploy it as exe or as a war into JBoss. This is not to say, that your exe file is secure: depending on how it is implemented it may allow all sorts of attacks, but again, this is equally true for any mechanism.

Restful versioning

In RESTful or any application versioning I see that versioning is done by adding version to URL of the endpoint, e.g.:
http://app/api/customers/1234
http://app/api/v3/customers/1234
http://app/api/v4/customers/1234
Does it mean that app is deployed to different servers and all three are maintained or how it is achieved?
It depends. It may be handled twofold:
Via the proxy server (e.g. nginx, apache) using the domain.
In this scenario proxy server recognizes the URL and using the version part of the domain decides where to forward the request. Basically, as far as I know, if the version is located in the path (e.g. http://app/api/v3/customers/1234) this scenario is rarely used. It's used more often if version is located in the domain (e .g. http://v3.app/api//customers/1234)
In the application itself.
Application exposes all the endpoints and handles the version resolution internally.
No matter how it's handled you still need to synchronize the resources internally - in DB e.g.

Is middleware needed for a REST service to be consumed?

There is an external web-service (REST based) which provides logistics service. In order to consume it from our application (which is java stack), I created a client library (using jersey and jackson, which is a self-contained jar file, and gives simple getters and setters to work with). All that is needed to consume this REST service is this jar file (which is being used as re-usable asset).
However, one of our clients asked, "since we already have ESB (a middleware from IBM) for our existing integrations, why can we not have this integration also through ESB ?"
Is it possible to consume the REST based service using a middleware such as ESB(or MQ) ? If so, how ?
Will it be wise to do it ?
What arguments can I posit to my client to tell them this may not work ?
Thanks.
Is it possible to consume the REST based service using a middleware such as ESB(or MQ) ? If so, how ? -
Yes. Every ESB has its syntax/APIs. Should not be difficult to understand if you are already working with REST/http requests. Note, MQ is a message broker that will allow asynchronous communication. For example, the application that wants to consume the REST service can send a message to the broker and not wait for a response from the external service. The message broker in turn can talk REST to the external service. The message broker might expose a REST interface to consume messages. But it all depends on the use case. You may want to call REST service synchronously.
Most ESBs support calling external web services REST/SOAP. So an ESB does not necessarily mean MQ.
Will it be wise to do it ?
It depends. Many organizations set up ESB/Gateway as a policy and to route/filter/govern all external routings. Also to manage load, HA etc.
What arguments can I posit to my client to tell them this may not work ?
It will most certainly work. You should assess if using an ESB is an overhead based on your requirements.

Jaas session replication on JBoss 4.2.0

I've looked the web through and through in the search of answer to my problem but with no result so I reckon that's the ultimate place when anybody can have a clue what the solution might be.
Long story short: we have a jsf web application running on JBoss 4.2.0 GA server. We are in the process of replicating the application to several servers which is generally a smooth ride with just one single exception: JAAS. We use Jaas as our security mechanism but can't get the Jaas session replicated. When load balancer switches user to different server, the user has to log on again (however the jsf session state is not lost, it's gets replicated with no problem). How can we get Jaas to replicate its session over several servers? Is it possible in a stright way?
Or do we have to tinker with programmatic authorisation, which in case of Tomcat, seems to be possible only by reflection?
You need to look in cookies. Better to use some HTTP protocol sniffer.