Task Attachments

I am trying to get attachments from delegate using methods of TaskService, like

  • getTaskAttachments(String taskId)
  • getProcessInstanceAttachments(String processInstanceId)
  • getAttachment(String attachmentId)
  • and other

But all these methods return empty array or null. Although i have seen attachments in database and content engine shows all attachments in content engine.
Also works content-api/content-service/content-items/{attachmentId}/data rest request.
How can i get attachment of task in delegate class?
Upd: Using Content service i have got attachments, but i build it manually.
How get this Content service in delegate?

In your delegate, you can call org.flowable.engine.impl.util.CommandContextUtil.getContentService()