XMPP - Spring Integration: Does the spring application run an embedded XMPP server - java

I'm trying to integrate instant messaging in my application that is based on the usual Spring-Maven stack. Two possibilities that I've come across are to either use raw Smack (igniterealtime.org) or go for the spring-integration support for XMPP (which is also based on Smack). My question is; "Is it required to run an XMPP server like openfire alongside or is there a possibility of the XMPP server running embedded within my application running on tomcat?". What would be an efficient scheme for the scenario? Thanks

The Smack (and therefore Spring Integration XMPP) is just an API (Client) for that protocol and what you need to know and configure is XmppConnection and particular host/port to connect.
To right an application based on those component you don't need to run an XMPP server.
For example we tested Spring Integration against regular Google Chat.
So, yes: Spring Integration doesn't run Embedded Server and even doesn't require an external to be run for you locally.

Related

Connecting to windows server from PCF

I came across a very different requirement today where the Application running in PCF has to connect to Windows-Server and execute some business logics.
Currently the teams are achieving it using VB-Script. The command looks something like this
Dim computerToConnect As New System.DirectoryServices.DirectoryEntry("WinNT://" + Server + ",computer")
The same functionality the teams are trying to achieve through a spring-boot app running in PCF Linux stack.
Is there a way to achieve this in Java ?
Answering your question:
Yes, it is possible to connect into Windows Server from Spring Boot.
You can start from:
Investigate better what you really need to do inside the Windows Server, to understand how you can translate it in Java/Spring code;
Investigate what kind of authentication your company use in the Windows Server;
For example, if your company use LDAP/OpenLDAP, you need to learn how to connect from Spring Boot app into Windows Server using this kind of authentication;
Configure your Spring Boot app with the credentials to handle the authentication;
After authenticate, consume the resources you want, similar to VB-Script.

Configuring Java Client for Hazelcast

I am trying to configure a JAVA client for Hazelcast. I have a web application deployed on tomcat servers. The example that I am following is this
Basic Clients Hazelcast. I have copied the code into my local machine and when I simply run it without running anything else and without the addAddress() step I get a java.net.ConnectionException. My doubts are:
1) What is the client in this case (I am assuming it is the web application that probably means I have to get the Hazelcast server up and running then what is to be done)?
2) How do I establish a link between the web app, the tomcat server and hazelcast cluster? The web app uses MongoDB as the backend. I was able to do a only MongoDB with Hazelcast integration but not the web app on tomcat server integration. What role does tomcat play here in this setup?
3) In the example what are the start.sh and stop.sh supposed to do? Where should I run them? If I simply open the git bash and run it. It doesn't seem to work.
I have looked at the documentation provided in the Hazelcast manual but I wasn't able to understand it as my current level of knowledge is woefully inadequate. If somebody could explain it to me or paste the links to some of the obvious stuff that I should know it would be great.
The answers are inline:
What is the client in this case(I am assuming it is the web
application that probably means I have to get the Hazelcast server up
and running then what is to be done)
The web application can be a Hazelcast client if you would like to use Hazelcast in client-server topology.
How do I establish a link between the web app, the tomcat server and
hazelcast cluster. The web app uses MongoDB as the backend. I was able
to do a only MongoDB with Hazelcast integration but not the web app on
tomcat server integration. What role does tomcat play here in this
setup.
Your web app runs in Tomcat server (web container) and the Hazelcast client you use in your web app can directly connect to the Hazelcast cluster members (server). You will just need to configure your client properly such as adding cluster member address by using clientConfig.getNetworkConfig().addAddress() API. Please see for more details about configuring client in this link: http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#configuring-java-client
In the example what are the start.sh and stop.sh supposed to do.
Where should I run them. If I simply open the git bash and run it. It
doesnt seem to work.
Those are sample start scripts for the sample client and member application. You don't need to use them in your application.
Please see the following guides for using Hazelcast in client-server topology:
https://hazelcast.org/getting-started-with-hazelcast/
http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#getting-started-with-java-client

Java Desktop Application Client-Server all in one

I'm thinking about what might be the best solution to create a standalone client-server application in java with these features:
Server: it must provide APIs (probably rest?)
Client: javafx webview with angularjs to make requests to webserver.
Loader; it starts the server and the client;
The user can then manage the application directly from the webview or from the browser (to the server port)
This would also be able to create in the future a "cloud" version of the application, the client instead to query the localhost will perform to a remote server.
A solution of this type is correct?
What might be useful tools for its realization and how could it be structured?
I would like in particular a solution which does not require the use of a large Java Application Server, but something more simple that it can be included as a library.
I thought same architecture which you think because it's easy. localhost binding, angularjs, bootstrap in java Webview. one of solutions is Spring MVC Rest API with embedded tomcat. it may be not lightweight.

Communication between the standalone Java service and Tomcat8 through JMS

Is it possible to create a Communication between the standalone Java service and Tomcat8 through JMS?
I need that standalone service act as a Publisher and Tomcat as a Subscriber.
External devices send data over a socket connection on standalone service. Once the message is received and parsed, the service sends it to Tomcat.
I don't want to use DB for this communication.
Please send examples of the implementation. Preferred Spring JMS but not mandatory.
thanks in advance
It is doable with or without Spring JMS. Main point is that you would need to host JMS server somewhere anyway. Let say you are using ActiveMQ server.
You will need to add dependencies on ActiveMQ client libraries into both of your projects (Tomcat8 and standalone Jar). You can use Spring JMS in both projects.
Than you create queue in your Active MQ server.
Your sender application will use ActiveMQ client libraries to send the messages to created queue.
Your Tomcat8 application will register listener on created queue using ActiveMQ client libraries.
EDIT
Here are links I suggest to follow:
Installation section of ActiveMQ. Don't know your prefered system, so pick by yourself. It is very easy to install it.
Official Spring guide for creating JMS project. Use sending part for your standalone project and listener part for your Tomcat8 application.

Develop generic JMS messaging framework code

I need to develop JMS based application which will asynchronously process inbound and outbound messages with third party systems.
Is it possible to develop generic JMS application which at runtime may use MQSeriers or WebLogic JMS? any examples of these?
If you want to use a App server agnostic Message System, you can try something line HornetMQ, RabbitMQ or ActiveMQ and check how you can use them from your application (these MQ's can be configured apart from any application server) or you can check how you can integrate them with a specific server.

Categories

Resources