Bpmn process does not deploying

In my case, we need to generate the BPMN process at runtime and deploy the generated BPMN process to the process engine.
Here is the code I am using to deploy a BPMN process via string

repositoryService.createDeployment().
                    addString(
                            definition.getKey() + ".bpmn", 
                            ((GeneratedProcessDefinition) definition).getBpmn())
                    .deployWithResult();

The createDeployment function did not throw any error.
But after that when I try to get the process definition by the key the engine tells me there is no such process definition exists.

Can someone help me? Thanks.

My fault. The generated process did not mark as executable.