Commit Graph

73 Commits

Author SHA1 Message Date
Ryan Baxter
3cc416b10b Removed unused property from POM 2018-05-25 13:36:05 -04:00
Dave Syer
8e9a5504cb Revert to snapshots 2018-05-21 10:05:42 +01:00
Dave Syer
c29f800380 Update to 1.0.0.RC1 2018-05-21 10:04:54 +01:00
Dave Syer
b59b43ddc5 Only expose Publisher via FunctionCatalog
Flux.from() is cheap and can be used to marshal the inputs everywhere
internally. With this change users ought to be able to register any
function of any Publisher type.
2018-05-01 12:06:34 -04:00
Dave Syer
59f94c1533 Fix potential issue when Message is not available but not needed
If an isolated function doesn't have Message in its classpath, we
will never actually need to instantiate that class. This change
makes sure we check first.
2018-04-25 07:27:33 +01:00
Dave Syer
04f917c113 Make it explicit that stream does not depend on a web server 2018-04-24 14:18:45 +01:00
Dave Syer
c2568ccabe Compiler warnings 2018-04-16 16:39:37 +01:00
Dave Syer
98cf4dc06e Revert to snapshots 2018-04-16 16:22:02 +01:00
Dave Syer
d1bcb7d142 Update to 1.0.0.M6 2018-04-16 16:04:31 +01:00
Dave Syer
5aeba1ea96 Convert Consumer<Foo> to Function<Flux<Foo>,Mono<Void>>
This results in a better experience for users because the consumer
that they write is only applied to a Flux that is subscribed to
by the framework once. It gives better control over the flow of
foos, e.g. if some component wants to subscribe on a thread.
2018-03-26 10:06:13 +01:00
Dave Syer
0bd71e61e0 Extract common logic in invokers into base class 2018-03-20 17:40:06 +00:00
Dave Syer
9012143093 Share unrouted messages amongst consumers and functions 2018-03-20 16:42:01 +00:00
Dave Syer
0be5f14766 Provide new config options for streams enabling composition
User can switch off source or sink behaviour (the default is to bind
to input and output streams), and then configure the name of a
supplier (for a source) or consumer (for a sink).
2018-03-18 14:19:51 +00:00
Dave Syer
efc99d2af0 Revert to snaphots 2018-03-16 11:40:12 -04:00
Dave Syer
feb8f51c41 Update to 1.0.0.M5 2018-03-16 11:28:53 -04:00
Dave Syer
33b33adb4b Change FunctionCatalog to key off Class<?>
Makes it possible to support other "function" types in the future.
The user is always taking a risk with the lookup that the object
returned has the generic type desired (but that hasn't changed
with this commit). FunctionCatalog is a lot simpler as a result
and also a lot more flexible.
2018-02-28 14:18:09 +00:00
Dave Syer
616e2825c6 Move FunctionCatalog into context module 2018-02-27 09:05:28 +00:00
Dave Syer
a2a2932715 Revert to snapshots 2018-02-21 07:24:21 +00:00
Dave Syer
72efd58675 Update to 1.0.0.M4 2018-02-20 19:25:11 +00:00
Dave Syer
8cd2675986 Add tests for various scenarios of message conversion 2018-02-16 10:31:28 +00:00
Dave Syer
1b624c3531 Support for isolated class loaders extended to cover more functions
Functions with Flux and Message (as well as POJOs and Flux of POJO
which were already supported) should now work if they are created in
an isolated class loader. Preconditions:

* The class loaders must have the reactor-core (and reactive-streams)
shared between the app and the function. Practically speaking this means
there has to be a parent class loader with just reactive types, and
sibling children for the app and the function. This is not a new
requirement (it was needed for Flux of POJO anyway).

* Message types are handled reflectively, so they don't have to be in a
shared class loader. But they do have to be  on the class path on
both sides (obviously).
2018-02-16 08:16:55 +00:00
Dave Syer
73098244e3 Revert to snapshots 2018-01-20 11:57:49 +00:00
Dave Syer
77e0a5c514 Update to 1.0.0.M3 2018-01-19 13:55:34 +00:00
Dave Syer
1af0d451cf Migrate to servlet binder for web features 2018-01-03 15:06:33 +00:00
Dave Syer
47fd4c3ed2 Going back to snapshots 2017-12-01 10:31:18 +00:00
Dave Syer
b6310e1811 Update SNAPSHOT to 1.0.0.M2 2017-11-28 13:40:35 +00: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
2438baff10 Add TODO comment 2017-11-10 14:45:59 +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
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
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
Dave Syer
61a902ce9a Add spring-cloud-function-dependencies and use it throughout 2017-09-15 09:34:44 +01:00
Dave Syer
31f4afa5ff Off by one error in comment 2017-08-08 09:47:48 +01:00
Dave Syer
5622a9e2cb Remove custom conditions from spring-cloud-function-stream
It didn't really make any sense to have custom conditions that
depend on the presence or absence of beans of type Function,
Supplier, Consumer because the actual endpoints are derived
from the FunctionCatalog (which might not be based on
bean definitions). This approach is far simpler, and
reduces the amount of custom code in the stream binder.

The spring.cloud.function.stream.supplier.enabled flag
is awkward, so we should try and find a way to avoid that.
There's also no reason it should need to be set in the
deployer tests.
2017-08-08 09:39:15 +01:00
Dave Syer
947ce93d77 Remove redundant comment 2017-07-17 13:54:37 +01:00
Dave Syer
c8646d64d8 Strangle old inspector methods
Fixes gh-81
2017-07-13 13:37:45 +01:00
Dave Syer
7e966c73ca Adds routing keys in message headers
If the incoming message has a stream_routekey header, we use that
to route the message to a named function. Also adding the header
to messages coming out of suppliers.

The biggest change here is sort of orthogonal: it fixes a bug where
Spring Integration would subscribe twice to the same input channel
if the FunctionCatalog contains both functions and consumers. Then
when a message comes in it is dispatched to one or the other, but not
both. So the routing key couldn't work without fixing that
problem.
2017-07-13 13:32:32 +01:00
Dave Syer
da0c954135 Add get*Names() to FunctionCatalog
We could go wit a separate interface, but it seems sensible to
keep it together really, so that callers don't have to downcast.
2017-06-29 14:43:19 +01:00
Dave Syer
2dd7dfb900 Tweak logic in stream invokers
* If there is only one function, use it unconditionally
* If no functions match, ensure that null is not the selector
* If a conversion succeeds, check the type of the result
2017-06-29 14:29:01 +01:00
Dave Syer
0756dc3394 Add support for Message<Foo> in stream apps
The FunctionInspector needs to be able to distinguish between a
function of Flux<Foo> and a function of Flux<Message<Foo>>. Then
it can do the conversion a level below.

Only supports Message->Message or POJO->POJO (no mixtures), so there
is only one new method in FunctionInspector.

No support in the web endpoints yet. But it's probably not so hard
to add.
2017-06-15 12:32:46 +01:00
Dave Syer
d641aae494 Make spring.cloud.function.stream.endpoint optional for stream apps
If there is only one function you shouldn't have to set any configuration
to get a stream app to run. This also implementation supports multiple
functions, trying to guess which one to use based on the type of
the incoming message payload. In principle that could be strategized
as a simple router function (e.g. to look for a header with a function
name).

If there are functions and consumers in the same app, they will
subscribe to the same input channel (and hence by default Spring
Integration will load balance between them). This could also probably
use some more features, to specify the desired behaviour.

If user *does* supply spring.cloud.function.stream.endpoint then it
is used and overrides all other possible routes.
2017-06-02 18:11:25 -04: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
Marius Bogoevici
4a1972dcf1 Add conversion support for Stream 2017-04-25 08:28:38 +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