Hi @ryancq,
My Zero database contains control data for a documentation management system, the documents are held in Azure Blob Storage. When a new tenant is added they select the document collection they want. Zero places a message in Azure Queue Storage with the tenant name and the relevant collection Id. The function app is triggered from the queue,
Immediately after each document is placed into Blob Storage the uri is saved in Zero and the control data updated in Zero. At the end of the process, which is extremely CPU heavy, I want to tell the user that the documents are now ready to use. All the hard work is done, my question is one of best practise, how best to send a call to Zero from the function app to notify the user the job is done?
Hi Aaron, Long time no see!!!! A clear and precise answer as always, thanks a lot. I'll close this issue now I know what to refer to next time I have to look at this (it's a low priority and a lower priority after your post!). Bob
bump***
dotnet core, angular, 6.8.0 An architectural question. My app has to create a set of default documents for each tenant as the tenant is created and it is very heavy on processing. I have implemented a separate project for Azure Storage Queues within the Zero solution, inject it and simply place a request on the queue. I have an Azure function app which polls the queue and creates the documents for the new tenant, all abstracted away from the main processor. So far so good. How do I send a notification through Zero to the user when I'm done? There is no "SendNotification" call in the API, do I need to write one? It's no problem to do so but I only ask in the interest of best practise and you guys always point me in the right direction.
@wizgod, UserFriendlyException is designed to return an error message to the client. If you're throwing it in a Hangfire job there is no client, use standard exception handling or simply log the error.
Code was refactored, I am closing this issue to save anyone spending time on it.
.net core, angular, 6.8.0 I am testing a proof of concept with Syncfusion's document editor and need to convert a .docx file to .sfdt file (syncfusion format) on the server side before editing. My service method looks as follows:
[DontWrapResult(WrapOnError = true)]
public string Import(IFormCollection data)
{
if (data.Files.Count == 0)
return null;
Stream stream = new MemoryStream();
IFormFile file = data.Files[0];
int index = file.FileName.LastIndexOf('.');
string type = index > -1 && index < file.FileName.Length - 1 ?
file.FileName.Substring(index) : ".docx";
file.CopyTo(stream);
stream.Position = 0;
WordDocument document = WordDocument.Load(stream, GetFormatType(type.ToLower()));
string sfdt = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
return sfdt;
}
Following Syncfusion's instructions I have a call from angular to same which works fine as follows:
public loadFile(file: File): void {
let httpRequest: XMLHttpRequest = new XMLHttpRequest();
httpRequest.open('POST', 'http://localhost:22742/api/services/app/NcSyncfusionDocumentEditor/Import', true);
httpRequest.onreadystatechange = () => {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200 || httpRequest.status === 304) {
this.documentContainer.documentEditor.open(httpRequest.responseText);
this.documentContainer.documentEditor.isReadOnly = false;
} else {
alert('Fail to load the document');
console.error(httpRequest.response);
}
}
};
let formData: FormData = new FormData();
formData.append('files', file);
httpRequest.send(formData);
}
My question is how do I convert this call to use the swagger interface - how do I add the form data to the call?
this._ncDocumentEditorService.import( ?? file ??)
.subscribe(sfdtDocument => {
this.documentContainer.documentEditor.open(sfdtDocument);
this.documentContainer.documentEditor.isReadOnly = false;
});
Hi @ismcagdas, Ok, I hear what you're saying. At the moment I'm up to my ears trying to feed my logs into Sumo Logic. Once I'm done I may be to reach out and see if I can filter out these types of erros as exceptions in the end solution. Can we leave this item as open and I will revert when I know more.
Because the user has left open the system in the browser or has entered an incorrect password. In a large system this happens so often that it is extremely difficult to find exceptions thrown by the system as a result of cose error.
@demimursa, I stand corrected but flummoxed as to why a 401 should be considered as an exception, it's a user error not a system error. Can anypone throw any light on this?