WorkflowReplayer replayWorkflowExecution

Hi
I have exported the workflow history from temporal UI(8088), which is a son file and trying to replay with
WorkflowReplayer.replayWorkflowExecution(
new File(absolutePath+"/dithostory.json"), MyWorkFlowImpl.class);

I am getting exception –
io.temporal.common.converter.DataConverterException: com.google.protobuf.InvalidProtocolBufferException: JsonObject

Please let me know I thought json works for this case, may be I am missing some thing

Currently the JSON that you get from the Web UI needs a little bit of “massaging” to get it working with WorkflowReplayer. We are working on fixing that.

The problem is some properties, for example via Web UI you get:

"eventType": "WorkflowExecutionStarted",

where it should be:

"eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED",

(the SDK needs the enum types, not the enum values)

You can take a look at this JSON for example where I went and did all the find/replace to fix it: temporal-patient-onboarding/onboardingrunhistory.json at main · tsurdilo/temporal-patient-onboarding · GitHub

If you send your JSON history I can do the same for you and then you can see the diff to do it yourself.

Getting execution history JSON from the CLI (tctl) should work however, could you test?

Hi
I also got the same exception.

My setting:
Temporal server: docker-compose v1.11.3
Temporal Java SDK: 1.0.7

First, I exported the json file from Temporal UI:

[
	{
		"eventId": "1"
		...
	}
]

Then I got the exception:

io.temporal.common.converter.DataConverterException: com.google.protobuf.InvalidProtocolBufferException: Expect message object but got: [{"eventId":"1","eventTime":...}]

So I modified the json to: (add "events")

{
	"events": [
		{
			"eventId": "1"
			...
		}
	]
}

But still got:

io.temporal.common.converter.DataConverterException: com.google.protobuf.InvalidProtocolBufferException: JsonObject
Caused by: com.google.protobuf.InvalidProtocolBufferException: JsonObject

I roughly checked the enum types in json and thought they are correct:

"eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED"
"kind": "TASK_QUEUE_KIND_NORMAL"
"initiator": "CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED"

The most weird thing is that I tried patient-onboard but still got another exception:
(temporal-patient-onboarding/onboardingrunhistory.json at main · tsurdilo/temporal-patient-onboarding · GitHub)

java.lang.RuntimeException: query failure for workflow_id: "workflow_id_in_replay"
run_id: "run_id_in_replay"
, queryType=__replay_only, args=Optional.empty, error=io.temporal.internal.replay.InternalWorkflowTaskException: Failure handling event 5 of 'EVENT_TYPE_ACTIVITY_TASK_SCHEDULED' type. IsReplaying=true, PreviousStartedEventId=3, workflowTaskStartedEventId=9223372036854775807, Currently Processing StartedEventId=3
Caused by: java.lang.IllegalStateException: COMMAND_TYPE_SCHEDULE_ACTIVITY_TASK doesn't match EVENT_TYPE_ACTIVITY_TASK_SCHEDULED with EventId=5

I’m trying to use tctl these days, but did you have any other suggestion?
Thanks a lot!

Updated the patient onboarding demo json, it was outdated - temporal-patient-onboarding/testrun.json at main · tsurdilo/temporal-patient-onboarding · GitHub
and enabled the replay test. Should be ok now. Thank you for noticing this.

Can you vote up issue Fix workflow history json (displayed and exported) to work with Java SDK WorkflowReplayer · Issue #350 · temporalio/web · GitHub?
As it stands right now for Java SDK the only options for WorkflowReplayer is indeed to manually change the enums in json.
Would be great to get this fixed asap.