Commit Graph

255 Commits

Author SHA1 Message Date
Dave Syer
7b46f925d7 Switch to SmartInitializingSingleton to avoid early instantiation
Use of BeanProcessor to catch a bean before it is used is a bit
agricultural these days. SmartInitializingSingleton is better and
frees application logs from one more annoying INFO log on an
early instantiation

2018-01-04 14:17:05.930  INFO 23472 --- [       Thread-0] trationDelegate$BeanPostProcessorChecker :
  Bean 'org.springframework.cloud.function.web.flux.ReactorAutoConfiguration' of type
  [org.springframework.cloud.function.web.flux.ReactorAutoConfiguration$$EnhancerBySpringCGLIB$$8d4844e]
  is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-01-04 14:27:32 +00:00
Dave Syer
9c1a9bff4e Fix reactor dependencies 2018-01-03 15:59:20 +00:00
Dave Syer
1c0b603986 Add back spring-cloud-function-web (faster startup)
With this change there are now 2 choices for web endpoints. The
stream servlet binder is useful for multi-binder use cases
(e.g. HTTP -> message broker).
2018-01-03 15:06:33 +00:00
Dave Syer
1af0d451cf Migrate to servlet binder for web features 2018-01-03 15:06:33 +00:00
Dave Syer
540b4d378e Update sample builds to latest versions 2017-12-11 15:39:01 +00:00
Dave Syer
2895a4597d Add vscode cache to ignored files 2017-12-11 15:39:01 +00:00
Dave Syer
5314466655 Add notes on Start-Class and MAIN_CLASS
Fixes gh-128
2017-12-04 09:40:50 +00:00
Dave Syer
be61ad07bd Clean up class loader on close() 2017-12-04 09:40:42 +00:00
Dave Syer
91c3770ce6 Upgrade Spring Cloud in the deployer too 2017-12-01 10:31:18 +00:00
Dave Syer
e0cb718138 Update to Ditmars/Bismuth 2017-12-01 10:31:18 +00:00
Artem Bilan
46fdca479b Properly resolve FactoryBean for function
Fixes: gh-118

When the `BeanDefinition` for `Function` is a `FactoryBean`
(e.g. `GatewayProxyFactoryBean` in Spring Integration) and that
`BeanDefinition` isn't registered as `@Bean` method (e.g.
Spring Integration Java DSL parser), the `ContextFunctionCatalogAutoConfiguration`
doesn't resolve the target `Function` type properly

* Get the target `Function` bean type via `BeanFactory.getType(String)`
* Make fallback to the `Object.class` instead of bean type since we are
expecting here a generic type anyway
2017-12-01 10:31:18 +00:00
Dave Syer
47fd4c3ed2 Going back to snapshots 2017-12-01 10:31:18 +00:00
Dave Syer
6cc2289f38 Update mvnw script to choose profiles 2017-12-01 10:29:57 +00:00
Dave Syer
b6310e1811 Update SNAPSHOT to 1.0.0.M2 2017-11-28 13:40:35 +00:00
Dave Syer
24bd68ddb9 Remove s-c-stream as mandatory dependency
Fixes gh-130
2017-11-28 13:32:35 +00:00
Dave Syer
9c8003eea6 Update Spring Boot version 2017-11-28 13:13:50 +00:00
Dave Syer
f2cde3ffbf Update thin launcher to 1.0.8 2017-11-28 11:43:56 +00:00
Dave Syer
e824fbf6cb Isolate the context class loader if function appears to need it
When a function is created using an isolated class loader it might
want to use that class loader again for its invocations, and a lot
of tools (Spring etc.) use the context class loader for that kind
of thing if they don't have an explicit default value. So we
set the context class loader before, and unset it after, the
function invocation using a convenience wrapper.
2017-11-25 05:25:29 +09:00
Dave Syer
e1bce8c292 Change name of property endpoint -> defaultRoute 2017-11-24 13:28:31 +09:00
Dave Syer
f3951cba66 Prefer explicit route to default 2017-11-24 13:21:08 +09:00
Dave Syer
0e21a30459 Don't use properties to fix the function endpoint
There are multiple functions in this sample, and they are
all addressable, so we don't need to force all messages to go
to uppercase.
2017-11-24 12:42:21 +09:00
Dave Syer
1ee517ab01 Use unique function if there is only one and name not provided
If the user doesn't ask for a specific function, but there is only
one possible choice, we can just use that.
2017-11-24 12:41:10 +09:00
Dave Syer
8459fb4e30 Ensure a concrete type with parametrric subtype is detected
If user defines their own @Beans from conrete types that implement
Function<...> then their type signature is detectable from the
class.
2017-11-20 15:34:06 +00:00
Dave Syer
7bf7b8b9c0 Update to latest snapshot of thin launcher 2017-11-17 15:04:41 +00:00
Dave Syer
66beae56bd Add test for multi-valued response 2017-11-15 13:57:05 +00:00
Dave Syer
219d056801 Add FunctionRegistry interface (writable FunctionCatalog)
This makes dynamic function registration (after context starts) much
easier. Also frees us from having to employ BeanFactoryPostProcessor
and other tricks to get the functions registered on startup.
2017-11-13 14:13:59 +00:00
Dave Syer
41d1dfa6bc Add public registration method to bean post processor
Also simplifies logic of looking up message types
2017-11-13 09:27:36 +00:00
Dave Syer
85ba0b480e Fallback to Object.class not the function type
See gh-118 (partial fix)
2017-11-10 17:38:45 +00:00
Dave Syer
d4b87c1fe7 Initial support for composable functions
There's a test for each of the supported types. No error handling
yet.

Fixes gh-122
2017-11-10 16:45:11 +00:00
Dave Syer
2438baff10 Add TODO comment 2017-11-10 14:45:59 +00:00
Andy Clement
aaa6b6526c Faster compilation of functions
This change includes caching and smarter analysis of classpaths
to limit the amount of jar walking necessary to find dependencies
when compiling. It also includes some new tests that verify
packaging of dependencies in boot style form (BOOT-INF/lib and
BOOT-INF/classes).
2017-11-10 14:45:46 +00:00
Dave Syer
8d5f09efa1 Add sample test data to README 2017-11-10 13:02:22 +00:00
Dave Syer
ad0ebd5cfc Add additional logic to function catalog to help with singletons
A registered singleton doesn't have a BeanDefinition, but it might have
a compiled type with enough generic information to pull out the
input and output types.
2017-11-10 12:11:55 +00:00
Dave Syer
7d7a783f0e Update maven wrapper 2017-11-05 12:52:31 +00:00
Dave Syer
d58c58b765 Add heuristic for Spring Boot fat jar
The function compiler knows how to extract jars nested inside
a Spring Boot fat jar. It's really slow (so that's maybe another
problem for another day), but it works now.

Fixes gh-115
2017-10-25 10:19:39 +01:00
Dave Syer
b1437fe9c0 Align pom names with artifact ids 2017-10-25 09:50:18 +01:00
Dave Syer
55b62d630b Remove @FunctionScan from samples where possible 2017-10-25 08:53:14 +01:00
Dave Syer
a27f1fe4dd Switch on @FunctionScan by default 2017-10-25 08:53:14 +01:00
Dave Syer
30b0d3a1c6 Introduce special handling for unconverted messages
Prevents odd looking exceptions when null pops into the stream
unexpectedly.
2017-10-25 08:53:14 +01:00
Manos Nikolaidis
08f2cb2491 Update README.adoc
Use correct path for samples. E.g. look at:

https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples
2017-10-25 08:49:25 +01:00
Erik Möller
49178f0389 Changed path from spring-cloud-function-sample-compiler to function-sample-compiler 2017-10-25 08:48:58 +01:00
Dave Syer
280fa5794c Subscribe to supplier flux in background thread
Stops application from blowing up if there are messages available
on startup and the broker is not there. There are still errors
(failed messages), but it doesn't stop the app from starting.

Maybe should be optional to fail fast?
2017-09-22 09:45:37 +01:00
Dave Syer
af8b6e253e Revert to snapshots 2017-09-15 17:49:31 +01:00
Dave Syer
858b7404c6 Update to 1.0.0.M1 2017-09-15 17:48:51 +01:00
Dave Syer
3ccb925733 Merge core packages into one 2017-09-15 17:10:00 +01:00
markfisher
dce30023e8 remove unused code 2017-09-15 11:36:46 -04:00
Oleg Zhurakousky
37fc3e6c65 Removed EmptyIterable
- Removed EmptyIterable as it's only used by _MemoryBasedJavaFileManager_
to ensure the contract of the _list(..)_ operation that must not return
null. The same contract is ensured with _new
IterableClasspath(classpath, packageName, recurse)_ while making
_MemoryBasedJavaFileManager.list(..)_ simpler and more consistent.
- Untill this fix the AbstractByteCodeLoadingProxy was building FQCN of
the byte-array defined class using Resource.getFileName() and then some,
which is not very reliable since if such name does not match the actual
name contained in the byte code, class loading will result in exception.
So, this fix reads FQCN from the actual byte code..
- Reduced visibility of AbstractByteCodeLoadingProxy
- Simplified ByteCodeLoadingFunctionTests

Closes gh-99
2017-09-15 16:30:12 +01:00
Dave Syer
986e76610c Clarify some things in the AWS adapter 2017-09-15 14:04:45 +01:00
Dave Syer
fbf62658e7 Cosmetic changes to metadata of sample 2017-09-15 13:51:40 +01:00
Dave Syer
dcdde7e067 Move AWS sample alongside other samples 2017-09-15 13:48:33 +01:00