When Spring Data Couchbase and Syncgateway Couchbase would support named scopes or collection - couchbase

Please find below a question on the Couchbase product roadmap.
CONTEXT
I am currently working on a feature to turn an existing system (a backend app and a mobile app) into a multi-tenant app.
The stack would be :
Couchbase 7.0
Spring Boot 2.5.5
Spring Data Couchbase : 4.2.5
SyncGateway : 2.8
PROBLEM
As far as I read in the documentation a good practice would be to use the new Couchbase 7.0 feature : Scopes and Collection.
However, everything does not seem to be ready :
The theory :
https://blog.couchbase.com/scopes-and-collections-for-modern-multi-tenant-applications-couchbase-7-0/
https://blog.couchbase.com/how-to-migrate-to-scopes-and-collections-in-couchbase-7-0/ and
In practice :
1- Spring Data Couchbase is (v4.2.5) not release yet to work with named scopes or collections
https://docs.spring.io/spring-data/couchbase/docs/4.2.5/reference/html/#reference
4.3.0-M3 github example give #Collection annotation which work but are not mentionned in the documentation.
2- Couchbase SyncGateway 2.8 is not compatible and 3.0 documentation does not mention a compatibility
Sync Gateway offers support for Couchbase Server’s default scopes and collections (Default Collections).
It does not currently support named scopes or collections (Named Collections).
https://docs.couchbase.com/sync-gateway/current/server-compatibility-collections.html#using-collections
QUESTIONS
To plan the project, or change the data structure (for example just using buckets) do you know when the full stack would be compatible with named scopes and collections ?
Do you know when Spring Data Couchbase 4.3.0 would be released (because 4.3.0-M3 version seems to be ok) ?
Do you know when a Syncgateway version compatible with named Scopes and Collections would be released ?
Thank you very much for your help.
Regards,
Matthieu.

Spring Data Couchbase 4.3.0 with Collections support is scheduled to be released on November 12. The try-cb-spring sample uses collections. I can't speak for Sync Gateway.
Mike

Named scopes and collections support on Sync Gateway is on our radar. We do not have a publicly available timeline at this point.
Note that until that is supported, there are alternate ways to deploy multi-tenant applications using Sync Gateway. You can point sync gateway databases to separate buckets or use the type value prefix pattern to segregate documents by tenant.
The new configuration approach in Sync Gateway 3.0 (beta) simplifies the administration of multi-tenant deployments by allowing sync gateway database configuration for tenants to be managed independent of each of other.

#MattMatt - I'm not familiar with the syncgateway api - but all that is needed for collection support for n1ql/query is an http parameter query_context=default:<bucket-name>.<scope-name> (bucket-name and scope-name escaped separately with back-tics) and then instead of specifying the bucket-name in the query, specify the collection-name. If the syncgateway has an api to add 'raw' http parameters, that could be used for n1ql/query without specific collection support.

Related

How to use different datasource of one microservice with multi instances

I'm working on a microservices architecture using Spring boot, my microservice A uses MySQL as a primary datasource I'm wondering could I make an instance of A and change datasource of that instance to MongoDB ?
Why I would do that ? well basically I'll have an endpoint which will handle a file uploads of million lines so I wish to have 2 datasources of that microservice.
Or should I duplicate A to another microservice B and use MongoDb as datasource and make a specific rest api ?
If you use ORM (and I believe you using it) you have to create a model for both databases, because of the different concepts of MySQL and MongoDB, you have different sets of annotations. For example, for MongoDB you must use #Document instead of an #Entity.
If only your service A targets this file uploads functionality - you can implement it together in one service.
If you have to make uploads from multiple services or if it makes sense to have separate scaling for service A functionality and file upload feature - make it a separate service for uploads.
In most cases, the second way is more attractive because it allows avoiding service duty separation in two services when you have requirements changes

Flutter connecting to a database in server

I'm new to flutter and i really want to know, is there a way to connect to a database server (for instance mysql) in flutter rather using firebase. I'm working on a smart parking system project where i need to insert the latitude and longitude of the parking area which is free into the database which is created in server and retrieve it whenever user requests for it. It would be great if anyone gives solution for above mentioned problem (Flutter with database).
Since Flutter is just a UI Framework, topics such as persistence and databases may be out of scope or may depend on the use case.
Flutter UI's can persist data (application state) for short periods of time in a manner that is really only useful for the purposes of creating a good User Experience (is this button click? is it green? etc.)
For persisting more useful data outside of the application and on the actual device, you may want to consider the Shared Preferences Plugin for Flutter.
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android),
providing a persistent store for simple data. Data is persisted to
disk automatically and asynchronously.
Now, if you require persisting data in any centralized manner (e.g. RDMS, Firebase, or any data persistence service) your options are:
Persistence options that have a Flutter plugin (e.g. Firestore, Firebase)
Build your own service layer using HTTP, gRPC that talks to some backend service that provides access to a data store. You can do this with Express, Rails, CloudFunctions, etc.
As for connecting directly to a database such as MySQL, I don't see why you couldn't do that (maybe there is some technical limitation), but this would be a very bad idea in any practical situations as (unlike Firebase/Firestore) you won't be able to protect your data store once any client application has write access.
It sounds like you need a central read/write data store, so your best bet may be to host a server that provides access to a database while exposing an API to Flutter for which you can use dart:io to make requests.
Try using sqflite. It's a package you can include in your Flutter app that allows you to persist data to the local device. You will need to use the path_provider as well. Here is the link to the repository on Github https://github.com/tekartik/sqflite

MySQL Workbench Model to Java Persistence Entity

I am designing a database using MySQL Workbench. I've defined a bunch of tables and set up relationship via foreign keys. I am preparing to forward engineer this model to a database schema. Where do I go from there?
What I am looking to do is take the new database and create the Java entities that will correspond to said tables for use in a SpringBoot application. I have seen a few posts that talk about different methods including Eclipse-based solutions that generate these artefacts, but many of these are older solutions and I'm not sure what the current "hot" tool is. Using Spring Source Tool Suite, I installed JBoss Tools which claims to do this via their Hibernate Tools Reverse Engineering utility, but I can't find any step-by-step documentation on how to proceed.
Since the project is in its infancy, I expect frequent changes to be made to the model and would like to consider a solution that can handle those types of updates as well.
In addition to the utilities listed in the comments, there are a couple of other possibilities I want to mention:
Maven Archetypes - Maven-based templating toolkits that can generate projects according to different configurations
JHipster - Yeoman-based templating toolkit that can generate opinionated best-practice Spring-Boot monolithic or microservice applications.
Number 2 is currently my go-to solution as it has a very active community and does a lot of "cool stuff".

Any ESB frameworks which provides API to host a webservice dynamically

i am performing an R&D to check whether are there any open source ESB frameworks which provides the following features
1. API to host a SOAP webservice/consume a service by providing the required data. We are working on a tool to design webservices for our product and the metadata created from the tool would be input to the API. What we are looking is that the metadata generated should be hosted as a webservice instantly without restarting the ESB container.
2. API provided by the framework to define the count of a service executions performed.
3. ESB framework which supports versioning both in hosting a service and also consuming a service.
It would be very helpful if someone can provide a direction to such ESB frameworks
Talend ESB provides the functionality you described.
it can consume a WSDL (your metadata created from your tool) to quickly create a web service service. It is hot deployed into a Karaf container (i.e. do not need to restart the ESB container)
you can use built in logging or custom logging to count executions performed.
it can be hooked into git or svn for versioning.
There is a free version you can download here.
Here is a basic tutorial on the product which demonstrates a. ingesting a WSDL, b. hot deployment, and c. execution count (though it does not go into how to log that).

Spring-insight source, design and alternatives

I've a few questions regarding the Spring-insight technology.
Is Spring-insight open source? I was curious to see the underlying design. I could fine the plugins' source but not the entire package (is it part of tc-server).
Can this data be persisted to a database (for later use)
I read that Spring insight should not be used for production use. I was thinking if this data could be persisted to some datastore and retrieved through a different application. Are there any existing alternatives to Spring insight?
Thanks in advance.
Is Spring-insight open source? I was curious to see the underlying
design. I could fine the plugins' source but not the entire package
(is it part of tc-server).
As of me writing this, Spring Insight itself is not open source, but the Spring Insight Plugins are released under the ASL 2.0 license.
https://github.com/SpringSource/spring-insight-plugins
Can this data be persisted to a database (for later use)
Data is saved internal to Spring Insight and is retained for a period of time (which is configurable). After that period, it is purged from the system. I believe 7 days is the default. There is no way at the moment to persist this data to an external system such as a MySQL or Oracle Database.
I read that Spring insight should not be used for production use.
This is old information. Originally Spring Insight was released as a developer-only tool, called Spring Insight for Developers. As the name suggests, this tool should only be used in development or possibly small QA environments. This tool can be obtained for free (as in beer) from here.
http://www.springsource.org/insight
For production use, you would want to use Spring Insight Operations. This is a commercial product which is available as a part of the VMware vFabric Product suite or by purchasing vFabric tc Server.