azure logic app to grab email attachment slow to trigger - azure-logic-apps

I have a azure logic app that monitors my emails and when target is found, it drops the attachment into blob storage. The plan is a consumption plan.
The issue is, sometimes it takes up to 50 minutes for the email to be grabbed and dropped. I know there is a startup time when things go idle, but I was reading seconds/minutes. Not close to an hour. Does anyone know how I can trouble shoot this?

sometimes it takes up to 50 minutes to grab and drop the email
Based on this doc ,
The reason for delay is:
When the triggers encounter a new file, it will try to ensure that the new file is completely written. For instance, it is possible that the file is being written or modified, and updates are being made at the time the trigger polled the file server. To avoid returning a file with partial content, the trigger will take note of the timestamp such files which are modified recently, but will not immediately return those files. Those files will be returned only when the trigger polls again. Sometimes, this may lead a delay up to twice the trigger polling interval. This also means that the trigger does not guarantee to return all files in a single run when "Split On" option is disabled.
For more information you can refer this:
. Automate tasks to process emails by using Azure Logic Apps | MS DOC, .
.How to Send an Email with one or more attachments after getting the content from Blob storage? | SO Thread & Logic app Created with add email attachments in Blob storage .

Related

Getting large images from mulesoft into salesforce

So currently I am doing a synchronous call to mulesoft which returns raw image(no encoding is done) and then storing the image in a document.So when ever we are getting bigger images more than 6 MB it is hitting the governerlimit for max size.So wanted to know is there a way to get a reduced or compressed image
I have no idea if Mule has anything to preprocess images, compress...
In apex you could try to make the operation asynchronous to benefit from 22 mb limit. But there wil be no UI element for it anymore, your component / user would have to periodically check if the file got saved or something.
you could always change the direction. Make Mule push to salesforce over standard API instead of apex code pulling from Mule. From what I remember standard files API is good for up to 2GB.
Maybe send some notification to mule that you want file XYZ attached to account 123, mule would insert contentversion, contentdocumentlink? And have apex periodically check.
And when file is not needed - nightly job to delete files created by "Mr mule" over a week ago?

Does JMeter scripts actually creates records in database

Let's say I run a recorded script for 'New User Registration' function of a web site to evaluate the response time for entire scenario. When I run the recorded script from JMeter, for each registration script, is there a new user record getting created in the application database ?
Yes, if you record registration and correlate it (meaning you create a valid unique name for every request) you will create a real user in your environment.
JMeter is simulating a real scenario which effect your environment.
That is part of the reason JMeter will be executed in different environment than production (as stage)
Well-behaved JMeter script must represent a real user using a real browser as close as it is possible.
Browsers execute HTTP requests and render the response
JMeter executes the same HTTP requests but doesn't render the response, instead it records performance metrics like response time, connect time, latency, throughput, etc.
HTTP is a stateful protocol therefore given you execute the same request you will get the same response. So if there are no mistakes in your script it either should create a new user or fail due to non-unique username error.
Yes, if your script accurately represents the full set of data flows associated with the business process, "New User Registration," then the end state of that process should be identical to that of the user behavior so modeled.
A record will be created in the database. If not, then your user is not accurate in its behavior

Getting server logout when running long batch jobs in Seam

One of the requirements I have is to generate flat files in a specific format. The user selects the year from the UI and clicks the generate button.
The flat files process usually takes 3 to 4 hours to generate all the files. When the process is running and flat files are being created, the UI shows a modal that the job is being processed.
The problem is that after the files are successfully generated, the UI redirects to the login screen. Instead I want to refresh the UI showing the message that the process has successfully completed.
I am looking for help on this. Also would increasing the conversation timeout or session timeout in web.xml help fix this issue?
yes you could increase both session timeout and conversation timeout (if doing work in conversation scope) so they exceed the duration of the job
a better solution may be to store information on the jobs in a higher scope (eg. application or to the database), then if the user accidently logs out the job will continue running and complete

Best approach for real time process information / Server + JS Client

I have a C# Web API project on server side and on front-end I have ExtJS 4.2.1 (Javascript framework client).
There is a section in my app where I request to start a long running process (about 5 minutes) and I want to show the user the status of the process being executed.
Basically, the process will run a special calculation for every employee in the database (about 800), so I want to let the user know which Employee is being processed in that moment.
So I was thinking in two ways of doing this, and maybe I don't know if having both is ok.
Use SignalR to show the information of the process in Real Time.
Write to a database table all the process log (every employee that its being processed).
If I use the first approach, if the user close the browser he will loose all the information about the process and if he log into the app again he will only see the actual status.
If I use the second approach, if he log into the app again he could see all the information, and using maybe a timer on client side the data could be refreshed every 5 seconds.
Does anyone have implemented something like this? Any advice is appreciated.
You should use a combination of the two. When you have calculated a employee save the state to the database and publish the change on a service bus.
Let SignalR pick these messages up and forward them to the client. This way the user will see old state when he connects and new state then they arrive with SignalR. I have created a Event aggregator proxy that makes this very easy.
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/wiki
Follow the wiki to set it up, here is a demo project
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/tree/master/SignalR.EventAggregatorProxy.Demo.MVC4
Live demo
http://malmgrens.org/Signalr/

c# .net in-memory persistence

I would like to have a "user message" available for every request sent back by the server. If there is not a user message, the message goes back blank. If there is one, an icon is activated on each user screen after their request is completed.
[edit]
The "user message" is something that is being set by an administrator for the application I'm deploying. The administrator can enter text into a field and click a button to send this message to every other user of the system. Any time another user performs any kind of action, the current user message is attached to the JSON response and handled by the front end.
In order to optimize this, I want the message to be stored in memory (not in the database).
I have tried to use static. I have tried to use HttpApplicationState. In both cases, the value of the user message is "blanked out" after some period of time. After some research, it appears that both statics and HttpApplicationState are subject to IIS and when it decides to recycle the application pool. (or some such)
This volatility of a static is mysterious: it should be static - so long as IIS itself lives, this variable should live. It should not be dependent on some kind of "reset" or whatever. The HttpApplicationState is some other situation that I don't fully understand.
I would like a way to store a value in a non-volatile variable that I can rely on. If I set this value today, it should be there tomorrow, or next week, so long as IIS is not stopped and restarted.
Any help?
here is what i have done to solve the problem as per the accepted answer below:
the user message is a sometime thing. so when the message gets set by some administrator, store the response in the database at that point in time and store it in the Application["UserMessage"] object.
when round-trips from users come in, the in-memory text for the user message gets added to the json return value.
the message can be cleared by the administrator at any time, which clears both the in-memory message and the database field.
when IIS decides enough is enough and recycles the application, the Application_Start() method (among other tasks) will also re-seed the user message from the database value that was stored when the user message was set (as per step 1).
now the application works as expected. no extra price is paid going to the database for every user request into the system - the user message always comes from memory. in addition to this, the database is updated or loaded for the user message very few times.
Application cache is a good place for it. The problem for you is, you think you cannot rely on it. Please see the later part of my answer where you will find how to make sure that the value is always there even if after iis restarts or iis recycles your application.
You can store the value in application cache. It can be done as follows
Application.Add(name,object)
Later you can retrieve it in each request by using this code
Application[name]
It works like session but the only difference is it is application wide and all the request from all user will get it. When you first time assign set the value, store it in db as well as application cache so that you can later make a query from db and store it in application cache if value is not there and then retrieve it from application cache.
You should restore the application cache from the database on Application_Start() event which fires every time the application starts or restarts. This way you can ensure that it is always in the application cache.
I would like a way to store a value in a non-volatile variable that I
can rely on. If I set this value today, it should be there tomorrow,
or next week, so long as IIS is not stopped and restarted.
In this case you cannot store this value in memory. The memory is something that is allocated for you by IIS to host the AppDomain of your application. IIS could recycle your application at any time and wipe out the memory. While IIS continues to live your application doesn't. So you cannot rely on it. The only reliable solution in this case is to persist this information in some non-volatile storage such as a file, database, ... the choice is really up to you but it should be out of the process of your AppDomain.

Resources