How to configure: WS-AT Narayana standalone? - web-services

I want to use Narayana - WS-Transaction in a standalone springboot app that calls two different Webservics in a single transaction. One of those internally uses db resource for insert/update.
Is standalone-WSAT-possible with narayana? If yes :
How do I configure UserTransaction, PlatformTransactionManger etc in Springboot java config?
How to add those two WebServiceTemplate (s) as "WS-AT transactional resources"?
The example here does not show those beans: https://github.com/jbosstm/quickstart/tree/master/spring/stock-market-with-narayana-spring-boot/src/main

Unfortunately there is no Narayana Spring Boot WS-AT quickstart that would show you how to utilize the technology. WS-AT is the best integrated in WildFly application server. You can find the Narayana quickstarts containing examples of running it at https://github.com/jbosstm/quickstart/tree/master/XTS. If you consider using Spring Boot then in general it should be possible but you need to configure all the integration on your own. That's not prepared and/or maintained by the Narayana team. You can get inspiration at quickstarts of itegrating Narayana with Spring Boot at https://github.com/jbosstm/quickstart/tree/master/spring. If you want to check how the integration to WildFly is done then a good starting point could be https://github.com/wildfly/wildfly/blob/master/xts/src/main/java/org/jboss/as/xts/XTSSubsystemAdd.java.

Related

What is the best way to host Apache Camel in AWS?

As we move our workloads to AWS I am looking for an ETL tool which is widely used and has the appropriate connectors - Apache Camel appears to fit the bill. However, I am struggling to find information on how Camel can be deployed in AWS - the obvious one is on an EC2 instance, but we would like to avoid the setup and maintenance required by Virtual Machines. I don't see anyone offering it as a managed service, so the option I'd like to explore is running it as a container in ECS, as we will have numerous other containers running.
Containers don't seem to be an installation option on the Apache Camel website - perhaps it is just too limiting for a tool whose purpose is to connect to everything else?
Is it acceptable and practical to run Camel in a container, and where could I find more information about it?
Apache Camel appears to fit the bill.
Indeed the Apache Camel is a great integration framework. And that's the point. It is a framework, not a product. So there are multiple ways to run the Camel flows. As a web app, as a standalone app, as a part if our own code. Camel itself is pretty agnostic to the way you run the flows and that's why you don't have very specific way enforced in the web site.
If you want an out of box product, which can generate containerized deployments with Apache Camel, you could have a look at Apache ServiceMix, Apache Karaf or it's supported RedHat Fuse.
Is it acceptable and practical to run Camel in a container, and where could I find more information about it?
It is perfectly fine.
Question: Can you (are you able) to create a docker container with your (any other) application?. Based on the question this skill is lacking and I really suggest to learn it.
You may check folowing post https://medium.com/#wkrzywiec/how-to-put-your-java-application-into-docker-container-5e0a02acdd6b
FROM java:8-jdk-alpine
COPY ./target/myapp.jar /usr/app/myapp.jar
WORKDIR /usr/app
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "myapp.jar"]
Let's assume you can run your ETL tasks as a standalone application, then just run it in the container as any other standalone application.
it we would like to avoid the setup and maintenance required by Virtual Machines
Question: how do you distribute your camel tasks? I mean - what is result of your build? A war file? A standalone app?
To build a web app you could see https://www.baeldung.com/spring-apache-camel-tutorial
The most convenient way to deploy a war file in AWS is AWS Beanstalk service.
If you build a standalone application (or use servicemix) and you can build a container, then indeed ECS or Fargate seem as natural options.

TEIID Springboot integration

i read about Teiid and i liked it, but because it has a lot of changes, i got some problems first to deal with it, but what i understand now is the following:
1- teiid wildfly and thorntail are going to be obsolete, so, i will not use them.
2- teiid spring boot and openshift are the most active projects now, so, i chose one of them which is sprintboot.
my thoughts for using teiid in springboot is for the following:
1- integrate my different schemas in a micro-service architecture pattern to solve the problem of data integrity for all services.
2- create a standalone data virtualization (data warehouse) for my internal database systems to be used in reporting.
for the reporting system, i created a ddl vdb file, and i was able to deploy springboot application with jdbc enabled, and used the existing Simple-java-client to connect to it, but i tried to use apache superset to get my reports in a BI application, and i enabled the ODBC with the postgres, but i always have the below error
Connection failed (psycopg2.OperationalError) TEIID30528 javax.transaction.SystemException: The system is only setup for spring managed transactions. If you need Teiid to manage transactions, then a third-party transaction manager like narayana-spring-boot-starter needs to be configured.
DETAIL: org.teiid.jdbc.TeiidSQLException: TEIID30528 javax.transaction.SystemException: The system is only setup for spring managed transactions. If you need Teiid to manage transactions, then a third-party transaction manager like narayana-spring-boot-starter needs to be configured.
although i tried to integrate with narayana, but i couldn't configure it,
sorry for this long discussion, but i need to know:
1- is the above approach is good, or should i try other things.
2- is the above error has any fix or there is any other suggested BI tool i can use with Teiid?
thanks in advance
What I can say (https://teiid.io/blog/post-2020-3) Teiid won't be obsolete for WildFly. The Teiid supports currently the WildFly and Spring Boot as could be found on their pages. If you are looking for the Java EE components and the best integration amongst other JBoss projects (e.g. Narayana) then you could try to check the WildFly version of Teiid. It's right that Thorntail develoment efforts are decreases for the sake of Quarkus. But it seems (as the post above mentions) the Teiid considers the support of Quarkus. But WildFly is(!) still supported.
On your question about the setup of the third party transaction manager for Spring Boot and with Narayana in particular you should check information from Snowdrop project and the README of the Narayana Spring Boot integration.
The thing which should be enough to configure the Narayana starter is to add the starter to your pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jta-narayana</artifactId>
</dependency>
If there is a need for configuring Narayana in particular the configuration properties start with spring.jta.narayana
thanks a lot for your help, and by adding the below dependency to the POM file
<dependency>
<groupid>me.snowdrop</groupid>
<artifactid>narayana-spring-boot-starter</artifactid>
<version>2.1.0</version>
and adding narayana.dbcp.enabled=true, spring.jta.enabled=true to the application.properties, i could do some graphs using the apache superset.
also, as long as wildly is still supported, i will go on for the wildfly solution, as it is more suitable to have more VDBs in a single container.
thanks a lot

How do deploy a play application on google cloud

This is my first time deploying an application. I have some idea about it but I am not sure if it is correct. How do I go about deploying a play application on google cloud?
1) I have created a package using dist command. I have the zip file now on my local pc. https://www.playframework.com/documentation/2.5.x/Deploying
2) Do I first need to create a compute resource on gcp? What configuration shall I use for the vm? My app is still in test phase so there are no external users at the moment
3) I suppose play uses netty web server. So do I need to install netty on the compute resource? I have looked online a bit but can't find a resource on how to deploy an application on netty.
deploy an application on netty
Netty is not a web server/application server, but an IO framework which can be used to build web servers or any high-performant IO applications.
If you really want to use netty, you need to write an HTTP server yourself, or just use an HTTP framework built on netty.
If you want to build an application using netty, have a look at the examples on https://github.com/netty/netty/tree/4.1/example/src/main/java/io/netty/example/
Deploying a container to the Cloud using Google Cloud Platform and Kubernetes Engine
Kubernetes is a way of orchestrating containers in the Cloud, enabling you to do things like auto-scale, fast deploys and manage running versions of containers. You simply create a container and upload it to a container repository. In this example I used Google’s Container Registry, it’s really simple to use and works brilliantly with their Kubernetes implementation.
follow this tutorial might help you with this
https://medium.com/beyond/deploying-a-container-to-the-cloud-using-google-cloud-platform-and-kubernetes-engine-10d8ee3aba86

Meteor Framework on AWS

I have an application developed in Meteor Framework.
We are planning to move it to AWS withmulti AZ deployment
need Master Slave configuration for the Mongo DB
My question is how to achieve this, i believe mongo db comes bundled in with the Framework itself,
never worked on it so any help will be appriciated.
Thanks
Welcome to Stack Overflow.
Mongo is bundled into the development environment, but not the server.
It is normal to host the database either on a different server of your own, or using a database service (there are many around, such as compose.io, Mongolab etc) So Mongo can be set up for load balancing and scaling independently of the app itself.

Deploy of Clojure/Clojurescript application in production

I'm playing with Clojure/ClojureScript and I'm writing a web application. Everything is fine while I'm using ring as a development server.
The question is what container should I use for production? Should I use ring for production as well? Should I use Tomcat? Is there a recommended way to deploy a Clojure application? Can you point me to some documentation regarding this aspect?
Thanks!
There is nothing inherently different about deploying a java servlet that was written in Java vs. Clojure and all the Clojure web libraries and frameworks produce compatable servlets so you have many deployment options.
We use netty to run our ring based web application to great effect in production simply by running "lein run" from a system service. Many others choose to use lein uberwar to produce a war file and host that on tomcat. The specific hosting mechanism seems less relevant than the deployment process. All the JavaScript files are served from a CDN. Immutant is also a fun and very Clojure oriented choice with a strong "enterprisy" feel to it.
What strikes me as most important is building a repeatable build, including deployment. Pallet is a great way to go though it's got a bit of a learning curve.
There are a few options.
First one is easy: Heroku. They have a free tier that is ample for deployment and testing. I won't go into further detail on this, but I decided not to use Heroku anymore.
Another common option is Amazon AWS. I gather most apps on AWS use lein-beanstalk [sorry, no citation here]. Lein-beanstalk has been out for quite a while and appears to be well-maintained. It is also maintained by the same person who maintains Compojure.
I use a VPS. I set up the linux build with Nginx and deploy with git. So, basically, my flow is create the site, compile to lein uberjar, then deploy. I know that some people can and do use the leiningen "lien ring server" cantation on their apps and use many other configurations, such as Maven, Tomcat, deployment with Vagrant, etc, but I just run java -jar myApp-xxxxx on the server and it works great.
As far as documentation, there does appear to be a dearth of documentation on Clojure deployment specifically. Sort of have to bang your head against the wall and figure it out if you want to go the VPS route the first time you do it. I found that almost none of my issues involved Clojure specifically.
In development I use:
lein ring server
: then to compile it to a war file I use:
lein ring uberwar
: and just drop the resulting jar file into the Webapps directory and it works fine. I use Jetty by the way