Commit Graph

151 Commits

Author SHA1 Message Date
Oleg Zhurakousky
8ea309c45b Clean up and simplifications around CloudEvent processing
This commit effectively a merge of work with #607 and simplifies the following
- CloudEventAttributesProvider now provides CloudEventAttributes initialized with defaults to be set by the user
- In HTTP RequestProcessor the logic of sanitizing headers was improved to ensure that correct prefix is applied

Resolves #607
2020-11-16 13:40:53 +01:00
Oleg Zhurakousky
40d06b8c95 GH-422 GH-606 Add support for normalizing structure-mode CE message
Normalizing in this context means converting it to binary-mode so the rest of the processing logic is the same.
Added support for canonical attribute names. Now, internally any attribute can be set as 'ce_' regardless where it came from are where it goes to as the frameork will be able to recognize both
Removed CloudEventMessageConverter
Renamed CloudEventAttributes to CloudEventAttributesHelperas it is better suited to what it actually does
2020-11-16 12:06:33 +01:00
Oleg Zhurakousky
b9f417a4da Make CloudEventAttributesProvider a FunctionalInterface
Related to #422 and #606
2020-11-16 08:41:42 +01:00
Oleg Zhurakousky
632e73caf9 Fix CloudEvent prefix and fix the name of CloudEventAttributesProvider.java 2020-11-13 16:07:33 +01:00
Oleg Zhurakousky
f0b2ce7691 GH-422 GH-606 Add support for simplifying message headers to attribute mapping
Added CloudEventAttributesProvider and default implementation
Added CloudEventMessageUtils
2020-11-13 10:24:27 +01:00
Oleg Zhurakousky
a26ad928f6 GH-422 Formalize Cloud Event conversion strategy to consistently handle binary-mode and structured-mode cloud events
Moved CloudEvent related artifacts to ‘cloud events’ package with hopes to eventually donating it to CNCF SDK
Created CloudEventUtils identifying necessary constants and utility methods
2020-11-12 17:01:42 +01:00
Oleg Zhurakousky
27d0d8afd9 GH-422 Add RabbitMQ instructions for Cloud Events interaction 2020-11-11 11:53:39 +01:00
Oleg Zhurakousky
eba94a699b PR-605 less formatting
Resolves #605
2020-11-09 16:16:23 +01:00
Oleg Zhurakousky
68319b1869 GH-601 add test to validate the issue is fixed
Resolves #601
2020-11-09 15:35:35 +01:00
Oleg Zhurakousky
ca9ffb06e7 GH-602 Ensure collections with converted items are not converted again
Resolves #602
2020-11-09 14:07:20 +01:00
Oleg Zhurakousky
c21bc3895d Additional clean up and polishing 2020-11-04 10:43:29 +01:00
Oleg Zhurakousky
ba15726c9a Re-enable support for around advise 2020-10-26 08:29:16 +01:00
Oleg Zhurakousky
bee53fceb3 Consolidate mechanisms around retaining headers and skipping input/output conversion 2020-10-23 13:19:03 +02:00
Oleg Zhurakousky
222aac77cc GH-596 Add support for handling conversion of complex types
Resolves #596
2020-10-21 14:36:50 +02:00
Oleg Zhurakousky
818cda144c Deprecate and remove all usages of FunctionInspector 2020-10-19 18:11:11 +02:00
Oleg Zhurakousky
3f1315c523 Consolidate isMessage() operation 2020-10-19 14:57:55 +02:00
Oleg Zhurakousky
89466b5cdc Refactor FunctionCatalog implementation 2020-10-16 17:59:06 +02:00
Oleg Zhurakousky
43290cc529 GH-568 Add support for casting resulting function as Runnable
Resolves #568
2020-09-21 17:22:38 +02:00
Oleg Zhurakousky
186c0b7a26 GH-588 Fix dropped headers during input conversion
This addresses the issue of dropped Message headers in the event where input is a Message but input conversion is not necessary
while Message contains headers that require explicit propagation (e.g., scf-sink-url, scf-func-name)

Resolves #588
2020-09-18 18:46:52 +02:00
Oleg Zhurakousky
d3afd1fea4 GH-587 Add support for inferring 'accept' content type for simple types
This fix also introduces new Function property 'accept' with no default value which implicitely would default to application/json unless the output type of the function is String at which point it would default to text/plain. However, if it was explicitely set in FunctionProperties it will be used regardless of the function output type.
Resolves #587
2020-09-16 18:14:40 +02:00
Oleg Zhurakousky
ddba54dee6 Various polishing to accomodate boot, reactor and other changes 2020-08-04 19:21:14 +02:00
Oleg Zhurakousky
62ab95196e GH-550 Add support for wrapping value into Message if necessary
Resolves #550
2020-06-19 15:26:28 +02:00
anshlykov
a97bdcafd4 SimpleFunctionRegistryTests: reactive function test case
FunctionTypeUtils#isTypeCollection: unwrap publisher

JsonMessageConverter: handler for a ParameterizedType conversionHint

refactor
2020-06-17 08:58:46 +02:00
Oleg Zhurakousky
00ffb59b99 GH-503 Add test to demonstrate custom message converter usage
Resolves #503
2020-06-11 15:36:27 +02:00
Oleg Zhurakousky
6bfc614f9f GH-531 Fail function registration for incompatible types
Given that we now can auto-discover function type from provided target object, this fix will fail function registration if provided type is not compatible (assignableFrom. . .)

Resolves #531
2020-06-10 18:28:28 +02:00
anshlykov
dfa02750c1 Migrate to JUnit 5
spring-cloud-function-context

spring-cloud-function-context: fix

spring-cloud-function-web

spring-cloud-function-adapters

spring-cloud-function-samples

spring-cloud-function-deployer; spring-cloud-function-kotlin

Resolves #535
2020-06-10 16:43:04 +02:00
Oleg Zhurakousky
ce28ce2cb6 GH-514 Remove 'proxyInvokerIfNecessary()' method
It is really not needed as it does not add much value other then allows user to cast POJO function to its actual type. The reality is that the actual goald of POJO function is to make sure they can be looked at as plain Functions.

Resolves #514
2020-05-26 15:46:42 +02:00
Oleg Zhurakousky
7bd84c79a2 GH-499,498 Add support for SupplierExporter to control output content-type
- Add 'contentType' property to ExporterProperties to assist SupplierExporter with delegating it to function catalog
- Add additional logging and testing
- Change JsonMapper to abstract class providing special handling of conversion of Json Sting to byte[]
2020-04-20 07:06:18 +02:00
Oleg Zhurakousky
fd93beefdb Fix regression for implicit composition
Also, added message check in AWS destination resolver
2020-04-16 21:05:20 +02:00
Oleg Zhurakousky
8f7672399f Extract common code from BeanFactoryAwareFunctionRegistry
. . . to ensure that we can have the version of FunctionRegistry that is not dependent on BeanFactory.
2020-04-16 13:42:17 +02:00
Oleg Zhurakousky
c41ee39358 Remove dead test 2020-04-06 18:26:13 +02:00
Oleg Zhurakousky
db839ed360 Remove additional compiler dependencies 2020-04-06 18:19:58 +02:00
Oleg Zhurakousky
1ec107abbd GH-474 Add TypeResolver library and simplify type discovery
For complex cases where deep hierarchies are used there was still an issue with the fix in #473.
By adding TypeResolver library we essentially simplify our discovery process

Resolves #474
2020-03-30 17:26:01 +02:00
Oleg Zhurakousky
86d12f3a84 GH-473 Fix type discovery for generic parameters
Resolves #473
2020-03-30 10:56:00 +02:00
Oleg Zhurakousky
85000ee084 GH-460 Add support for function filtering
Added support for function filtering in the event there are more then one function in catalog. This is primarily to ensure that
we have a mechanism to specify which functions to export as web enpoints (instead of all)

Resolves #460
2020-03-23 11:19:40 +01:00
Oleg Zhurakousky
919b9902e9 Improved handling of output Message conversion
remove the check for 'accept' header
added test

Resolves #465
2020-03-18 17:01:55 +01:00
Eric Bottard
b28c7c5cfc Add a test for accept being multi-valued and tested in order 2020-03-18 16:59:09 +01:00
Oleg Zhurakousky
fb095f7ac3 Improve output type conversion handling
- Re-enable, clean and improve  special handling for collection/array output type
- Add tests to validate and demonstrate the differences in  special handling of collection of Messages ve collection of non-Messages

Resolves #464
2020-03-18 15:50:55 +01:00
Eric Bottard
b1d9890e0c Don't treat byte[] or collections in a special way. 2020-03-18 13:59:21 +01:00
Oleg Zhurakousky
0acff2b1d3 Enhancements to content-type negotiation
- Added logic to wrap custom (user) message converters with NegotiatingMessageConverterWrapper
- Removed 'addDefaultConverters' flag from ContextFunctionCatalogAutoConfiguration as it is more confusing then useful
- Added test which uses wild card accept content-type with several converters available to ensure the appropriate one is used
- Made NegotiatingMessageConverterWrapper package private and moved it and it's test to a contex.config package

Resolves #462
2020-03-18 11:15:03 +01:00
Florent Biville
046913de99 Add tests to NegotiatingMessageConverterWrapper 2020-03-18 11:05:16 +01:00
Oleg Zhurakousky
b71c793dab GH-458 Remove default dependency on ApplicationJsonMessageMarshallingConverter
Resolves #458
2020-03-10 16:13:28 +01:00
Oleg Zhurakousky
2b4f8c7958 Clean up FunctionTypeUtils.isOfType method 2020-03-02 09:55:45 +01:00
Oleg Zhurakousky
f4530e0d89 Fix to-Message conversion logic
Fixed  logic to ensure that for cases where user may return a Message with no contentType set, the property-set content type is propagated
2020-02-22 08:24:27 +01:00
Oleg Zhurakousky
313f10946d GH-439 Fixed main class discovery
The regression was caused by filtering main classes that are @SpringVootApplication only, essentially excluding @SpringBootConfiguration

Resolves #439
2020-01-29 18:38:09 +01:00
Oleg Zhurakousky
d334ed609c GH-444 Fixed support for default function lookup
Given that function can be looked up with no definition, the fallback alternative should be 'spring.cloud.function.definition' property

Resolves #444
2020-01-28 15:50:42 +01:00
Oleg Zhurakousky
35d3c45959 GH-1896Stream Fixed conversion of collection of messages 2020-01-27 17:25:21 +01:00
Oleg Zhurakousky
52b0fdea50 GH-434 Added generic FunctionInvoker for AWS
- Added generic FunctionInvoker capable of handling the request generically without requiring user to implemen specific AWS request handler

Resolves #434
2019-12-16 14:27:41 +01:00
Oleg Zhurakousky
a0f072a11d GH-429 Fixed logic behind 'composed' flag
Fixed and simplified logic behind 'composed' flag in FunctionInvocationWrapper and added additional test

Resolves #429
2019-12-06 09:27:22 +01:00
Oleg Zhurakousky
00ec268aca GH-420 Fix discovery of function type from class
Fix introspection over ScannedGenericBeanDefinition

Resolves #420
2019-10-29 19:50:39 +01:00