question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to pass multiple values into a PublishEvent

See original GitHub issue

Hi Daniel, I have a Step that is a WaitFor and I need to pass more than one value to the PublisEvent, how can I achive that?.

And example could be if you change the example 4 and in the MyDataClass add a second property

public string StrValue2 { get; set; }

then in the Step build you add another output

public void Build(IWorkflowBuilder<MyDataClass> builder)
        {
            builder
                .StartWith(context => ExecutionResult.Next())
                .WaitFor("MyEvent", (data, context) => context.Workflow.Id, data => DateTime.Now)
                    .Output(data => data.StrValue, step => step.EventData)
                   .Output(data => data.StrValue2, step => step.EventData)
                .Then<CustomMessage>()
                    .Input(step => step.Message, data => "The data from the event is " + data.StrValue)
                .Then(context => Console.WriteLine("workflow complete"));
        }

I try to define a new instance of MyDataClass and assign values into StrValue and StrValue2 and pass that object into the publishEvent var values = new MyDataClass(); values.StrValue=1; values.StrValue2=2; host.PublishEvent("MyEvent", workflowId, values);

the problem is that the ProcessOutputs recive in the body the entity MyDataClass and dosn’t now how to look for the values to assign in the output data.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danielgerlagcommented, Nov 13, 2017

Have you tried casting the EventData, like this?

.Output(data => data.StrValue2, step => (step.EventData as MyDataClass).StrValue2)

0reactions
bautigaraventacommented, Oct 29, 2018

Hi, How could I achieve multiple Outputs in the EventData when I want to load my workflow by JSON? I don’t know how to do the “cast”, I mean this: (step.EventData as MyDataClass).StrValue2

Read more comments on GitHub >

github_iconTop Results From Across the Web

How pass 2 parameters to EventEmitter in Angular?
If you look at the EventEmitter emit method @ angular.io, it can only take a single parameter of type T. emit(value?: T).
Read more >
How to pass multiple data items from Particle device to webhook
My question though is - how can I get the webhook to dissect and understand the parts of a data string in the...
Read more >
How to send multiple parameters to Event in LWC
Pass a JS Object direct into detail const selectedEvent = new CustomEvent('custevent', { detail: { type: "Fiat", model:"500", color:"white" } ...
Read more >
Unity Events, passing multiple arguments
To test the event, you can add a canvas with a text component to the scene, and add the following script to the...
Read more >
Send multiple parameters in LWC Events via Detial property
Our focus will be to learn how to send multiple parameters in LWC Events ... Solution – Passing multiple parameters through Events in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found