SCDF - Header Enricher Processor with multiple headers - spring-cloud-dataflow

I've deployed spring-cloud-dataflow with Docker. These are the used containers:
springcloud/spring-cloud-dataflow-server-local:1.7.1.RELEASE
wurstmeister/zookeeper
wurstmeister/kafka:1.1.0
[other containers not involved in the issue ...]
Documentation consulted:
Spring Cloud Data Flow Reference Guide - 1.7.1.RELEASE
Header Enricher Processor
I am trying to use the header-enricher processor to add multiple headers, but i can only add one header.
With the following example:
time | header-enricher --headers="foo='bar' \n baz='qux'" --overwrite=true | log --expression=headers
Also add this propertie to the deployment
app.*.spring.cloud.stream.kafka.binder.headers=foo,baz
The header-enricher log is throwing next error at start.
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.transformer.support.ExpressionEvaluatingHeaderValueMessageProcessor]: Circular reference involving containing bean 'org.springframework.cloud.stream.app.header.enricher.processor.HeaderEnricherProcessorConfiguration' - consider declaring the factory method as static for independence from its containing instance. Factory method 'processor' threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1041E: After parsing a valid expression, there is still more data in the expression: 'baz'
EDIT: I am currently using these two ways to define the stream.
SCDF Dashboard: Throwing next error
SCDF Shell spring-cloud-dataflow-shell-1.7.2.RELEASE Throwing next error
and it seems that he does not accept the character \
Shell Quotes and Escaping

The issue is with your expression. You need to remove the double quotes
--headers=foo='bar' \n baz='qux'

Related

Issues with connecting Twilio Flex Digital Channels to Google Dialogflow CX

I have been following the blog post here and I've made it to testing the function on my local environment. I've copy and pasted everything form the blog into my text editor. Nothing in my code is original - but I cannot get it to work! When I try to run it in my local environment, I get this error:
const b = bindings[key].toString();
^
TypeError: Cannot read properties of undefined (reading 'toString')
at PathTemplate.render (/Users/dialogflow-cx/node_modules/google-gax/build/src/pathTemplate.js:114:37)
at SessionsClient.projectLocationAgentSessionPath (/Users/dialogflow-cx/node_modules/#google-cloud/dialogflow-cx/build/src/v3/sessions_client.js:1237:75)
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
at process.<anonymous> (/Users/dialogflow-cx/node_modules/#twilio/runtime-handler/dist/dev-runtime/internal/functionRunner.js:74:9)
at process.emit (node:events:390:28)
at emit (node:internal/child_process:917:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I don't know where to go from here! Help!
Here your TypeError is "cannot read properties of undefined", that means at least one of your passed arguments is undefined.
As we go through your return error, second line directs to the "projectLocationAgentSessionPath" and this section refers to the "Setup the detectIntentRequest" in the blog .
session: client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
The above error means at least on of the objects that relates to projectId, location, agentId, SessionId is returning undefined.
To resolve the error you have to check whether you are passing correct environment variables the same as .env files or not?
Within the error, we can see that there is a reference to the code you are working on:
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
This refers to this line:
client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
Following the code through the dialogflow library and then the Google API extensions library shows that ultimately the code is running through the keys of the object that relate to the project, location, agent and session which map to the 4 arguments above. And at least one of them is returning undefined.
Have you added the correct environment variables to your .env file? Are you passing a dialogflow_session_id when you make a request to test this endpoint?

Combining WareHouseModel and Experiments

I am trying to run experiments using the WarehouseRenderer and AgvRenderer from AgvExample.
I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve dependency for implementations of interface com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModel, as requested by WarehouseRenderer.builder().
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:437)
at com.github.rinde.rinsim.core.model.DependencyResolver.constructDependencyGraph(DependencyResolver.java:90)
at com.github.rinde.rinsim.core.model.DependencyResolver.resolve(DependencyResolver.java:115)
at com.github.rinde.rinsim.core.model.ModelManager$Builder.build(ModelManager.java:268)
at com.github.rinde.rinsim.core.Simulator.<init>(Simulator.java:88)
at com.github.rinde.rinsim.core.Simulator$Builder.build(Simulator.java:347)
at com.github.rinde.rinsim.experiment.Experiment.init(Experiment.java:191)
at com.github.rinde.rinsim.experiment.Experiment.perform(Experiment.java:195)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:202)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:193)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:258)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.github.rinde.rinsim.experiment.LocalComputer.compute(LocalComputer.java:81)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:684)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:703)
at agv.ExperimentExample.main(ExperimentExample.java:197)
This error indicates that there is a renderer attached to the simulator that expects a model of type CollisionGraphRoadModel. A renderer can only function correctly if there is a corresponding model that contains the data that needs to be rendered.
In AgvExample the following code (see lines 86-90) is used to add the required model:
.addModel(
RoadModelBuilders.dynamicGraph(GraphCreator.createSimpleGraph())
.withCollisionAvoidance()
.withDistanceUnit(SI.METER)
.withVehicleLength(VEHICLE_LENGTH))
You can add similar code if you want to use the WarehouseRenderer in your code.

GroovyObject class not found on Tomcat 8 with war of Grails 3.2.0

I deployed a Grails 3.2.0 WAR on Tomcat 8.5.6 and JDK 1.8.0_91 with a simple controller having following code:
package com.test
class MailController {
static responseFormats = ['json']
def index() {
Map headers = (request.headerNames as List).collectEntries { // It fails on this line
return [(it): request.getHeader(it)]
}
println "Incoming email $headers"
render status: 200
}
}
This code fails with the following exception:
Caused by: java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at groovy.util.ProxyGenerator.instantiateDelegateWithBaseClass(ProxyGenerator.java:225)
at groovy.util.ProxyGenerator.instantiateDelegateWithBaseClass(ProxyGenerator.java:193)
at groovy.util.ProxyGenerator.instantiateDelegate(ProxyGenerator.java:185)
at groovy.util.ProxyGenerator.instantiateDelegate(ProxyGenerator.java:181)
at org.grails.web.converters.ConverterUtil.invokeOriginalAsTypeMethod(ConverterUtil.java:161)
at org.grails.web.converters.ConvertersExtension.asType(ConvertersExtension.groovy:56)
at com.test.MailController.index(MailController.groovy:7)
at org.grails.core.DefaultGrailsControllerClass$MethodHandleInvoker.invoke(DefaultGrailsControllerClass.java:222)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:187)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
... 14 common frames omitted
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
... 27 common frames omitted
Before building the WAR file, I've changed the embedded tomcat to provided in build.gradle and also commented the groovy-ant dependency related to grails-core#10196
I see a answer here but that didn't worked and the above code is working fine when we run via grails run-app.
Update
I shorted down the issue. It is failing on this part only request.headerNames as List
I am pretty sure the problem is with the use of "as List". Mostly because Grails will overwrite Groovy's asType implementation which makes the "as X" coercion syntax work.
Grails does this to add support for things like JSON for marshalling known Grails types to web transport formats.
Unfortunately, in doing so Grails also breaks any asType function you might have declared yourself. Or in this case Groovy itself already declared for converting an Enumeration into a List.
It's quite annoying as Grails is effectively breaking existing contracts here and forcing you to modify upstream code to allow it to run on Grails.
That or dump Grails because it doesn't play nice with perfectly valid Groovy code.
I believe replacing "as List" with .asType(List) won't even fix the issue as you're still invoking the same code. At best you could try .collect([]) {it} instead. It may not be necessary to add the empty array as the first argument to collect.

SymfonyCMF RoutingBundle Doctrine PHPCR configuration error

i'm following the tutorial Creating a Basic CMS but after configurate the CMF RoutingBundle like it's shown in Enable the Dynamic Router i got the following error when i try to load the fixture data
PHP Catchable fatal error: Argument 2 passed to Doctrine\Bundle\PHPCRBundle\Initializer\GenericInitializer::__construct() must be of the type array, none given
here is my config.yml
cmf_routing:
chain:
routers_by_id:
cmf_routing.dynamic_router: 20
router.default: 100
dynamic:
enabled: true
persistence:
phpcr:
route_basepath: /cms/routes
you seem to have gotten a version mixup. you need either the 1.1.* family of phpcr-odm and phpcr-bundle with the routing-bundle 1.2.* or phpcr at 1.0.* and routing at 1.1.*
did you do any composer tricks or are the dependencies allowing this incompatible combination?

saxon: problem reusing XsltTransformer object

Using Saxon-B, I'm trying to follow the javadoc and serially reuse an XsltTransformer object.
I'm thwarted by:
Error
XTDE1490: Cannot write more than one result document to the same URI, or write to a URI
that has been read: file:/Users/benson/x/btweb/web_2_0/sites/us/errors/404/404.xml.prepared
2011-03-22 11:06:23,830 [main] ERROR btweb.compiler.CompileSite - Site compilation terminated with error.
btweb.compiler.CompilerException: Error running transform Cannot write more than one result document to the same URI, or write to a URI that has been read: file:/Users/benson/x/btweb/web_2_0/sites/us/errors/404/404.xml.prepared
It's probably Saxon-B bug. You can find more information here. According to this site "Fixed in 8.9.0.4".

Resources