My application is hosted in Episerver DXC and using CMS platform. As of now Emails are sending synchronusly and taking almost average of 1 second to send email.
I want to move this process into queue mechanism. As DXC in Azure, so Is episerver DXC will allow us to use Service Bus queue integration?
I am maintaing all application email templates into CMS and using [PlaceHolder] to replace dynamic content during sending email. So i want to move this complete logic into queue(i.e. Reading CMS template data from CMS database and replacing [PlaceHolders] with dynamic content and finally sending emails).
Is it best approach? or Can anyone please let me know other best solutions to acheive this feature in DXC platform?
Technically, yes, you can send messages to a separate queue on the same ServiceBus as DXC provides. But I don't think it would be a supported scenario. Episerver tends to be very protecting of core parts of the DXP infrastructure, so you would need to consult the DXP support on this.
Instead, you could use the Hangfire library to queue jobs in the database and execute them in background threads in Episerver. I know this is a very popular approach.
Or you could create a separate ServiceBus instance in another Azure subscription, which you maintain, and then proceed with the approach you described.
Thanks for your reply. I requested DXP team and waiting for their response.
Regarding, Hangfire => Does it effect any end user performance issues in future? if enable Hangfire into CMS website.
RE, new Azure subscription => Actually i need to connect to CMS database to get the email body(as i am maintaining all email templates in cms). I don't think DXP will allows us to connect to database from another Azure subscription. Does they allow?
Hangfire adds some tables to your database and runs a polling thread to check for any queued jobs to run. Whenever you want to execute a job, you queue the method with the Hangfire API, and it takes care of everything (including error logging and retrying).
You can limit the number of threads to minimize the load on the database if you have a lot of database work already. And you can even combine it with a ServiceBus queue if needed.
Regarding a separate ServiceBus, there are nothing stopping you from also subscribing to another ServiceBus from your Episerver code. You need add your own connection string and client code. But it still might be easier to develop against Hangfire than this.