I evaluate using Meteor Framework in Monitoring Application.
Use case. Java Application running in the cluster generates data. Web Application visualizes this data (charts, etc.)
Currently it is implemented with plain WebSocket and custom pub/sub mechanism.
Java App -> (publishes to) -> WebSocket Server -> (pushes to) -> Web App (Browser)
Technology stack:
Java (data generation)
Node.js (web server)
AngularJS (JavaScript framework)
Questions:
Is Meteor a good candidate for the same?
How will Java app communicate with Meteor? Java client or write directly to MongoDB?
Have found this java client https://github.com/kutrumbo/java-ddp-client
Is it relatively easy to use Meteor in existing Node.js application?
Yes meteor is a good candidate for those tasks! Your project seems to be a quite simple scheme for meteor, not a lot of data to publish and a need for realtime monitoring.
It depends on what you do need to achieve from your Java app
Java server changing the mongoDB : could be a way [edit] I never tried but now Meteor supports realtime DB publication once the MongoDB is changed externally (not more waiting for the 10 secs delay to be published). So just be careful to what you do change on it from the Java App.
Use your Meteor server as the client and pull the values from the Java part which would act as a server. This could be achieved using timers, it is easy to setup a java servlet (or whatever you want) and publish the result from the meteor server side if something interesting happened….
Use the java app to publish changes to the meteor server. That is probably what you are looking for, I could see 2 ways of achieving this.
Via a url. Setup meteor with a router such as iron-router, once your client will connect to the meteor server you will then be able to retrieve the query from the url and do what you want with it. The pro is that is it quite easy to just make a "get" call on the server's url from the java App, cons is that you might be restricted in the data format.
Via this wonderful DDP client to connect to your server, then invoke a method call from that last one. On the server, once the method is invoked just update the corresponding collections and you are done. DDP is really a simple protocol, clients are simple to setup so I would personally go for it.
My advise is to use Node plugin within Meteor. Meteor comes with Node already (it's his engine) and if you really need to you can still use node.js modules within, the inverse is much harder.
How to get started:
Install meteor on your computer
Create one collection test, publish it
Create a dummy webpage just to subscribe and display this collection
Once you are happy with the result, create a Method for updating the collection from outside.
Meteor.methods({
foo: function (arg1) {
test.insert(arg1);
}
In your java client:
DdpClient client = new DdpClient("localhost", 3000);
client.connect();
client.call("foo", objectToAdd); // something like this
You are done, here is a dummy project for adding from your java app an item into the "test" collection. As meteor is responsible for publishing all the content to the clients, you only need now to find a good graphic designer to make an awesome monitoring webpage….
Related
I am super new to React Native and want to use MySQL database to display data on my mobile application. This I have created a web service on JAVAEE Eclipse to connect to the database and perform CRUD operations. I am not aware of how to use the JAVA webservice as a funtion method to perform the desirable task on a button interaction. I will not be using web scripting like php and would definitely like to stay away from firebase and meteor types. It's a strict learning curve which I want to achieve without using different technology at the moment.
My development stack is React Native + JAVA + MySQL
No you'll not need to use or create any java function for this.
Use fetch or axios to call your services.
Let say your service is running on localhost and on port 2000,
now make sure your 1.server and 2.android phone in which you are running RN app are in the same network.
let say you have one service which returns a list of data.
now in react-native use
fetch("your machine/server's ip address + :port/serviceRouter or other things")
e.g.
fetch("http://192.168.0.2:2000/getData")
This will work the same as a postman.
You can find official docs for other details of fetch here
Is there a way to intercept network requests emanating from an iOS app in Java (Appium) automation code? Basically I want to mock the server calls with a local server but my requests are protobuf requests so I am unable to use a library like www.mock-server.com. There seems to be another project https://github.com/mkopylec/charon-spring-boot-starter but it also seems to reverse proxy URLs of the application it deploys and not an external application. Basically I want to be able to use an API that can reverse proxy calls from another app from my automation Java code but still be able to deal with Protobuf requests.
thanks,
Paddy
I have an app that has been developed using java and play framework. i have build two app one for the local and one for the remote to view its report data online. Actually i want to synchronize local database with remote database. The question is, how can i communicate and response data between two server programmatically in thread.
To communication between 2 PlayFramework Aps you can use standard REST WS on first App, and WS API on seccond one: https://www.playframework.com/documentation/2.4.x/JavaWS
But, for operations on two databases you should consider using xa-transactions: https://dzone.com/articles/play-20-framework-and-xa
I am learning to program Java. My objective is to create client server application based on Java and MySQL.
That would have following.
Server Application where all admin controls would be available to configure.
server application will be the only to have access rights to MySQL.
Server will have all functions and objects that clients will require and call and get that functionality. (Reason for that is "I don't want to share MySQL credentials to client apps or rather i don't want MySQL credentials to be transmitted on the network to clients"). As it would increase maintenance tough and it could be a security loop hole.
An analogy of functionality could be: client calls to server telling to add an Order such addOrder(order_id, payment,..,...,..) and so on.
What are the method in practice for such kind of application these days? A example code/or material to get in right direction would suffice
These days the universal way to expose a service remotely is via a web service. This solution was preferred by the industry over time due to its simplicity and ease of integration to the point that binary based protocols like CORBA are now seldom used.
Take the example of Android applications, they are native application mostly using REST web services.
A REST web service can be easilly integrated in the same way with a desktop application, a mobile application or a web application, even if the clients are written in different native platforms and languages.
As sample code, have a look at tutorials on the Spring stack. For the server see this tutorial for building an hello word REST web service. For the client, consider the REST template.
For security, see this Spring security hello world example. Using the Spring stack in Java will likelly give you the largest number of tutorials and online support.
This sounds like a good place to use RMI, which Java has built in support for. RMI will allow your client to call server-side methods on a local object that corresponds to the server, where all messages/commands get transparently sent to the actual server, where you have your DB access stuff and logic.
Anyone has expirience on having Jruby project running on Jboss (using torquebox or whatever) with an ability to communicate with another "japps" not on the same jboss where jruby app is, i.e. some java project on another jboss?
I know there is an torque-messanging but dunno if it's possible to communicate with external(out of jruby-app's jboss) app?
Best practices are welcomed.
Thanks in advance.
P.S. placing that other app on the jboss where jruby app is not acceptible solution.
I can recommend you to use Thrift and build communication via them.
Thrift have generator for both your needed languages (Java and JRuby) and provide good and fast communication.
UPDATED:
Thrift is RPC (remote procedure call) framework developed at Facebook. In detail you can read about it in Wiki.
In few word to save you time, what it is and how to use it:
You describe you data structures and service interface in .thrift file(files). And generate from this file all needed source files(with all need serialization) for one or few languages(what you need). Than you can simple create server and client in few lines
Using it inside client will be looks like you just use simple class.
With Thrift you can use what protocol and transport used.
In most cases uses Binary or Compact protocol via Blocked or Not-blocked transport. So network communication will be light and fast + with fast serialization.
SOAP(based on XML on HTTP) packages, its in few times bigger, and inappropriate for sending binary data, but not only this. Also XML-serialization is very slow. So with SOAP you receive big overhead. Also with soap you need to write (or use third-party) lib for calling server(tiny network layer), thrift already made it for you.
SMTP and basically JMS is inappropriate for realtime and question-answer communication.
I mean if you need just to put some message in queue and someone sometime give this message and process it — you can (and should) use JMS or any other MQ services(Thrift can do this to, but MQ architecture is better for this issue).
But if you need realtime query-answer calls, you should use RPC, as protocol it can be HTTP(REST, SOAP), binary(Thrift, ProtoBuf, JDBC, etc) or any other.
Thrift (and ProtoBuf) provide framework for generate client and server, so it incapsulate you from low level issues.
P.S:
I made some example in past https://github.com/imysak/using-thrift (communication via Thrift Java server + Java Client or node.js client), maybe it will be useful for someone . But you can found more simple and better examples.
Torquebox supports JMS. The gem you specified torquebox-messaging allows for publishing and processing of HornetQ messages on the local JBoss AS server/cluster that the JRuby app is running in. I don't think it currently supports connecting to remote servers.
Using this functionality in your JRuby app you could then configure your Java app on another server to communicate with HornetQ running in the JBoss AS that the JRuby app is running on.
Alternatively you could always implement your own communication protocol or use another Java library - you have access to anything Java you want to run from JRuby.
You can use Web Services or JMS for that