Commit Graph

144 Commits

Author SHA1 Message Date
Dave Syer
2a4c46f57b Remove unused methods in compiled functions 2017-05-26 10:28:43 +01:00
Dave Syer
99c7b995e0 Add FunctionFactoryMetadata interface for type discovery
The compiled functions implement that interface which means you can inspect
the signature of the method that created them and discover its
generic types.
2017-05-26 10:09:47 +01:00
markfisher
5a7c95bd97 add type info for compiled functions 2017-05-25 12:38:54 -04:00
Dave Syer
098c77279b Revert AWS sample to use logback 2017-05-25 15:40:10 +01:00
Dave Syer
f843821ebe Make adapter parent deployable 2017-05-25 15:40:10 +01:00
markfisher
841d4cdf48 fix compiled consumer sample 2017-05-25 09:27:49 -04:00
Dave Syer
c685866f09 Fix compiled scripts demo from README
Compiled functions always show up with no metadata, and you can only
guess what the types are from the bean definition. Probably we should
add more information to the bean definition if we have it when we
compile the function.

There is still a problem if user defines functions that are not of
Flux<String> (but that has always been the case).
2017-05-25 07:53:29 +01:00
Dave Syer
41b1a6584e Add logging config for AWS sample 2017-05-24 14:31:41 +01:00
Dave Syer
87f077954e Try to detect single-valued returns in AWS
Lambdas generally only deal with single values anyway, but for
consistency we should return similar results from a Lambda handler
as from an MVC handler in s-c-f-web.
2017-05-24 13:27:10 +01:00
Dave Syer
5589804d2c Add support for single valued Supplier as well 2017-05-24 11:00:32 +01:00
Dave Syer
20a6796793 Add support for rendering single value in response
If the request is a single value, we already know, so if we also
know that the function returned a single-valued type, then we can
render the single value, instead of an array with a single item.

See gh-36
2017-05-24 10:16:22 +01:00
Dave Syer
0d2418a47b Add "wrapper" type methods to FunctionInspector
These can be used to more reliably discover whether the user
has declared a function with flux types or "bare" POJOs. They
then pave the way to supporting single valued types in a special
way.

Also consolidate and simplify the logic in FunctionInspector
2017-05-24 09:10:46 +01:00
markfisher
719237e9c7 add adapters as child module 2017-05-23 16:30:18 -04:00
markfisher
78a37ef8ad avoid NullPointerException for warning diagnostic 2017-05-23 08:08:41 -04:00
Dave Syer
998ea3ad35 Fix and test bug with generic input or output types
Without this fix a Function<Foo<Bar>,...> shows as having an
input type of Bar - we need to only take the parameter if the
raw type is Flux.
2017-05-22 13:27:49 +01:00
Dave Syer
6e1f0b9a6e Add FunctionInspector to deployer so types can be inspected
ALso added a bunch of DEBUG logging because it's hard to debug the
deployer app.

Fixed gh-53
2017-05-22 10:57:47 +02:00
Dave Syer
3606e51d78 Fix deployer app
Run it, then

$ curl localhost:8080/admin
{"sample":{"name":"sample","id":"81c568e36c7909ec1dd841aa7ee6d3e3","path":"..."}}

undeploy:

$ curl localhost:8080/admin/sample -X DELETE
{"id":"81c568e36c7909ec1dd841aa7ee6d3e3"}

redeploy

$ curl localhost:8080/admin/sample -d path=maven://com.example:function-sample-pojo:1.0.0.BUILD-SNAPSHOT
{"id":"81c568e36c7909ec1dd841aa7ee6d3e3"}

(Takes about 500ms)
2017-05-19 11:29:03 +02:00
markfisher
56b9be9b6e add task sample 2017-05-17 22:35:10 -04:00
Dave Syer
120d2da496 Add support for POSTing a single POJO
You need to cache the request body so it can be read twice, once
to see if it's an array, and again to turn it into a POJO.
2017-05-16 10:26:10 +01:00
markfisher
ff78bfc438 ensure processor is initialized when getting type 2017-05-05 09:44:27 -04:00
markfisher
f6355df58d added rabbit binder dependency to sample 2017-05-05 09:20:03 -04:00
Dave Syer
69c22482d1 Add more subtle content negotiation in web layer
So that single Strings can be POSTed without JSON conversion.
There's still some work to do to support single POJOs in JSON, and
to reach parity with the WebFlux reactive type handlers, but it's
now closer to what we had before we moved the String conversion
out of the function layer.
2017-05-05 09:22:23 +01:00
Dave Syer
e2c257b3e7 Fix sample so the thin.profile=stream works 2017-04-27 12:33:08 +01:00
Dave Syer
995a12b234 Add forwarded header in gateway 2017-04-27 12:09:21 +01:00
Marius Bogoevici
e117cfd5bd Tentatively fix streaming issues
* Assume that the Function returned by FunctionCatalog
  is already wrapped as Function<Flux<?>,Flux<?>>
2017-04-27 07:34:24 +01:00
Dave Syer
f02f2eaf95 Remove unused annotation class 2017-04-25 11:47:50 +01:00
Dave Syer
39ca7952b9 Fix some tests
There is one behaviour change (you have to POST an array to a function
endpoint if you are sending a body), and also a message converter that
needed to be removed so that arrays are not toStringed in the response
body.
2017-04-25 08:51:31 +01:00
Marius Bogoevici
4a1972dcf1 Add conversion support for Stream 2017-04-25 08:28:38 +01:00
Dave Syer
4686e450b1 Alternative approach to MVC handling
Doesn't rely on manipulating the FunctionCatalog, and does type
conversion/coercion in the MVC layer.
2017-04-24 16:31:09 +01:00
Dave Syer
5055369cb5 Fix prefix issue 2017-04-24 16:31:09 +01:00
Dave Syer
b80ce1fb3e Update to latest reactor 2017-04-19 10:23:24 +01:00
Dave Syer
36c6b2dba7 Update versions of boot things 2017-04-12 17:57:28 +01:00
Marius Bogoevici
70dff6bb6b Enable JSON conversion for non-Flux functions
- use ProxyWrapper around a FluxConsumer as well
  making it consistent with the behaviour of Flux
  functions
- Enable introspection for scanned beans
- Fix failing tests by passing JSON string as input messages
  (marshalled form expected from the binder)
2017-04-06 08:24:51 +01:00
Dave Syer
d1cf9b47a4 Add some failing tests 2017-04-05 13:40:24 +01:00
Dave Syer
d67159729d Add support for explicit FunctionRegistration
A bean of type FunctionRegistration registers the function with
user-specified name and other properties, rather than relying on the
bean name.

Alternatively, function catalog keys can be specified as a
@Qualifier, which will be used instead of the bean name if
no registration is found.
2017-04-04 10:24:54 -04:00
Marius Bogoevici
82e19894b2 Add stream-function tests 2017-04-04 00:25:12 -04:00
markfisher
d208b5e0f3 stream consumer invoker target now expects Flux 2017-03-31 12:09:04 -04:00
markfisher
0b49edc2fd polishing 2017-03-31 11:43:28 -04:00
Dave Syer
3b598bd10c Break up comments in javadocs 2017-03-31 09:58:24 -04:00
Dave Syer
cea87fb8c0 Include cause in rethrown exception 2017-03-31 09:58:24 -04:00
Dave Syer
4346a7adc8 Re-use get, post, put etc. in overloaded methods 2017-03-31 09:58:24 -04:00
Dave Syer
2b88eaeb08 Extend support for simple types to Consumer and Supplier
The function catalog now always wraps beans that deal with non-flux
generic types.
2017-03-31 14:08:35 +01:00
Dave Syer
07c9d1c460 Remove unused method parameter 2017-03-31 13:56:25 +01:00
Dave Syer
38dcbaffff Add test for priority of looking up supplier in GET mapping 2017-03-31 13:48:36 +01:00
Dave Syer
cadd5546da Add custom HandlerMapping to allow more flexible request mapping 2017-03-31 13:44:11 +01:00
Dave Syer
787ab65d55 On POST to a Consumer, reflect input and send 202 2017-03-30 16:42:19 +01:00
Dave Syer
0d08735dda Test POST to Consumer
See gh-36
2017-03-30 16:42:19 +01:00
Dave Syer
8aefd9b472 Make rest template builder optional 2017-03-30 16:42:02 +01:00
Dave Syer
5162e6b149 Add gateway library for building micro-proxies 2017-03-27 10:42:05 +01:00
markfisher
98c2ca76f5 avoid Supplier NPE 2017-03-18 21:38:08 -04:00