Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Java support? #1

Closed
jplock opened this issue May 27, 2016 · 12 comments
Closed

Java support? #1

jplock opened this issue May 27, 2016 · 12 comments

Comments

@jplock
Copy link

jplock commented May 27, 2016

Should it be possible to support Java-based lambdas with this?

@mhart
Copy link
Member

mhart commented May 27, 2016

@jplock yep, it absolutely is – as it says in the README Java exists on the images, so you can run things manually yourself – I just haven't written a Java test runner yet.

I'll comment here when I have 👍

@utkuturunc
Copy link

I have three questions.

Has there been any progress on this?
Will it be possible to test Scala apps?
How could I help implementing Java support?

@mhart
Copy link
Member

mhart commented Mar 23, 2017

No progress – creating a Java runner is a different challenge to the others because it's not a dynamic target.

You can run Java (and hence Scala) in any of the images – the binaries and libraries exist on the base image, there's just no mock Lambda runner.

Creating a mock Lambda runner would involve replicating what has been done in the other languages (Python, Node.js) – essentially keeping as much as possible of the in-built Lambda runner and just swapping out the core invoker with a mock implementation.

@utkuturunc
Copy link

My goal is to use the following plugin in order to simulate scala microservices. As far as I understood, I need the runners.

https://github.com/serverless-community-labs/serverless-plugin-simulate

@mhart
Copy link
Member

mhart commented Mar 23, 2017

Probably – yep. Not entirely sure how they use docker-lambda but I imagine they're relying on the mock runners.

@timve
Copy link

timve commented Jul 4, 2017

I have been working on adding java8 support to docker lambda, see master...timve:java8 for the diff. It basically consists of two java processes:

  • a starter that sets up the environment and starts a separate JVM process where the lambda is invoked
  • an executor that sets up the context and can invoke the lambda

I would have liked to have used the actual lambda runner code from AWS in order to come closer to the real deal, but I run into issues with the native part of it.

The two main todo's are:

  • mimic the AWS lambda in unpacking jar / zip archive before running
  • setup remote debugging support (actually works, but requires the -Xshare:on option to be disabled)

It is not tested yet, the example java lambda code runs but I have not tested more complex scenarios yet.

Is this something that you would consider to add to docker-lambda ?

@mhart
Copy link
Member

mhart commented Jul 4, 2017

@timve – I've actually been working on a Java runner myself – I should've updated this issue. It's slightly separate from your approach I think in that I use the production runner jar, but I just swap out the class in the jar that communicates with the native library with a mock class.

Hopefully I'll have time in the next week to push something up – and I'll check out your solution too.

Thanks!

@timve
Copy link

timve commented Jul 4, 2017

@mhart Ah, sounds good, swapping out the native part with a mock sounds a bit closer to the real environment compared to my solution.
Interested to see what you have come up with, let me know if you require any help.

@mhart
Copy link
Member

mhart commented Aug 11, 2017

@timve finally got time to pushing my stuff up: #48

The example there in the PR description should work currently (lambci/lambda:java8 is up on Docker hub)

@mhart mhart closed this as completed in #48 Aug 13, 2017
mhart added a commit that referenced this issue Aug 13, 2017
@timve
Copy link

timve commented Aug 14, 2017

@mhart Thanks, neat little trick swapping out the LambdaRuntime class in the jar ;-). I will try give it a spin in the next couple of days.

@mhart
Copy link
Member

mhart commented Aug 14, 2017

@timve yeah, now if only it were as easy for .NET DLLs – then I could support the dotnetcore1.0 runtime too! 😉

@pallavi2146-zz
Copy link

Right now container(lambci/lambda:java8) running in my machine. Wants to debug in intellij idea. how can i do that. Kindly help me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants