Microservices (Calling the Dude)

@anon45965781 - You've posted so much amazing stuff on micro-services. I happen to have time on my hand lately (as many of us do I'm guessing).

Assume I know absolutely nothing- do you have a particular post either here or elsewhere (i.e. the official community) that best serves as a gateway to this brave new world?

I decided to make this a post instead of a PM in the hopes that it might help others who are also getting started.

2 Likes

Thank you so much for your posting! :slight_smile:

I've posted a couple of intro videos here on FMSOUP you can check out that show how to get started with the sparkjava framework and how to add a simple GET method to an existing service. I like sparkjava for lots of stuff. One thing I like is that sparkjava doesn't have all the "ceremony" of more complicated frameworks like SpringBoot yet lets you do things quickly.

Of course, you don't have to use Java, but I've been doing Java so long it was a natural choice for me. Plus, FMP has good support for Java with their JDBC driver and Java in general. Note that any JDBC code you write should mostly work on any database vendor since they all support the JDBC standard.

Java also gives you excellent 'packaging' options, like a JAR or WAR file. Using an IDE and "maven", you can easily create a "JAR" file (same format as ZIP) that has all the dependencies in it. Thus, your user, or you, only need to have Java installed. You can install a WAR file into an app server where it's always running.

Python would be my second choice using "Flask", but the web service programming language is a choice each developer or team makes.

Basically, regardless of the language (you probably already know this) you're just wrapping Java or Python or whatever code in HTTP method calls so you can call them from any HTTP-enabled application.


So, see if you can get the "hello world" intro service working. Then, you're ready to add some new method (aka, function) to do something totally new.

FMPDUDE-VIDEO: Creating a micro-service in a couple minutes (with FMP example)

Then check out the one that shows you how to add a new GET method and pass and process parameters.

I've posted more than 100 different programming samples that use micro-services and a FMP application on the FMI forum. Examples included Regular Expressions, date math, and more so if you need some project ideas, I'll happily post those.

Let me know how it goes for you. Post some code and we can all enjoy the experience.

I look forward to participating!

Will check back in soon.

Thanks again.

Stay safe.

4 Likes

One of the first thing you may need to decide is what technology you'll want to use for the majority of these micro-services and then look for specific tutorials on how to do it.

I tend to do mine mostly in Node.js or .NET.
Here's an excellent walkthrough on how to use Node.js using the free Visual Studio Code editor:


and then from there explore node packages with prebuilt functionality.

.NET is a little tougher because the learning curve to get into the language is a bit steeper.

3 Likes

Below is a listing of most of the examples I've published over the years on the FMI forum. This listing can give you a good starting point for some things you might like to do with a micro-service.

The way I posted examples (which always seemed to get a certain few folks riled up) was just to post, for an approach starting point, a high-level-but-working FMP example app solving the OP's problem using a micro-service. Then, expecting, further follow up from the OP, I would have included more detail or helped the OP with his code (but not just write the code for the OP).

The examples below are things that FileMaker cannot do at all, or cannot not do well or fast, or for easy API integration, or for things for which you would want the same code to run for other applications as well, and for lots of other things (categories not all mutually exclusive, of course).

Dropbox - Micro-service examples.txt - Simplify your life

Should we attempt a group project for something new?

2 Likes

Thank you fmpdude and Wim,

I'm pretty sure my first micro-service project (after my first thousand hello world failures) will be an image converter- size, file type, and hopefully color profile (i.e. Adobe RGB to sRGB). Does that sound doable? I'll have to look into image conversion utilities on Linux as a separate matter I guess.

My current solution for this (which cannot adjust color profile) uses sips on Mac OS and thus isn't available on Windows/Go/Web Direct. I'm in one of those industries where basically everyone uses Macs, so this solution has been fine for awhile.

I 100% agree that writing code for the OP's of the world is just the adult version of doing homework for someone else, so I very much appreciate the high level guidance. I'm not even remotely close to being able to ask for specific assistance. I have so much I need to learn first.

I'm learning this in conjunction with learning API integrations and of course supporting all my clients. Hopefully I'll be back here in a matter of weeks with specific questions, though it could be longer.

Certainly anyone else wanting to piggyback on this thread with micro-service discussion- don't mind me.

Sure, that's doable!

A while back, I created something like what you're doing for a website where users could upload images. My code auto-created thumbnails and created the link for an uploaded image.

Doing a quick search just now, I found this page which may be a good starting point (I would recommend you also get a StackOverflow account):

How can I compress images using java? - Stack Overflow

Assuming Java, the micro-service would run on Mac, Windows, or Linux with no problems. One consideration, however, is whether paths need to be local or remote. If you're always passing all the data to the micro-service, and getting data back from it, it can be pretty much anywhere (Local machine, server, anywhere on the Internet).

However, if you are creating files on disk, or doing other "local" stuff, then more thought needs to go into where the micro-service should be installed.

The way I would approach this would be to get the code working first standalone in a Java application. Once it's working there, then just migrate the code into a micro-service and either:

  1. Pass the file data in a POST body (FMP --> using Base64 functions),

or

  1. Pass a file path to the service and other parameters for what the service should do. (Here, you could just use a simple GET method, but in FMP --> use the GetAsUrlEncoded() function for the "/" characters.)

Remember to just build on to your "hello world" example should you choose to use the SparkJava framework.

If you believe your service will get to an enterprise level, you might want to jump right into the SpringBoot framework. That's what I use for lots of production stuff. This is the 800 pound gorilla, but there is so much documentation available, it's not that bad to get started.

Here's the web page with some more info:

https://spring.io/projects/spring-boot

--

I'll be glad to help you with coding issues as you get to them.

Enjoy!

3 Likes

Did you guys give up on trying a micro-service project?

Haven't heard anything back in a while. :slight_smile:

Microservice and API "stuff" is the future for myself and our product. Definitely haven't given up, but it is a long term thing with me.

There's actually been less of a slowdown with work than I expected. I'm at home, but still very much working and doing family stuff and all that. I mainly wanted to make sure that I started with the right posts/materials.

Excellent. Let me know when you're starting at it.

I would also recommend you check out SpringBoot for production work. More set up, but so much more built in so easier for more complex stuff.

I typically use sparkjava stuff for testing and small production needs. For serious client work, it's always SpringBoot.

Keep at it and let me know how it's going! :slight_smile:

Thanks Mac.