I am trying to configure dependency injection for azure web job using IoCManager. For example, I want to inject IRepository<Currency>.
I have done the following:
public class JobActivator : IJobActivator
{
private readonly IWindsorContainer _container;
public JobActivator()
{
_container = IocManager.Instance.IocContainer;
}
public T CreateInstance<T>()
{
return _container.Resolve<T>();
}
}
public class Program
{
public static void Main()
{
var config = new JobHostConfiguration()
{
JobActivator = new JobActivator()
};
JobHost host = new JobHost(config);
host.RunAndBlock();
}
}
public class Functions
{
private readonly IRepository<Currency> _currencyRepository;
public Functions(IRepository<Currency> currencyRepository)
{
_currencyRepository = currencyRepository;
}
public void ProcessQueueMessage([QueueTrigger("BuyerProfileQueue")] JobMessage message)
{
Currency currency = _currencyRepository.Get(1);
}
}
When job triggers, I have the following exception: Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service was found Any help would be greatly appreciated Pavel
Good day,
I am trying to push notifications from server to client side using abp notification system.
My StartUp.cs:
public class Startup
{
public void Configuration(IAppBuilder app)
{
...
app.MapSignalR();
}
}
My Web Service:
public class ContactFormsAppService : REPAppServiceBase, IContactFormsAppService
{
private readonly IAppNotifier _appNotifier;
public ContactFormsAppService(IAppNotifier appNotifier)
{
_appNotifier = appNotifier;
}
public void SendMessageForOffice()
{
_appNotifier.SendMessage(101, "Message");
}
}
AppNotifier:
public class AppNotifier : REPDomainServiceBase, IAppNotifier
{
private readonly INotificationPublisher _notificationPublisher;
public AppNotifier(INotificationPublisher notificationPublisher)
{
_notificationPublisher = notificationPublisher;
}
public async Task SendMessage(long userId, string message, NotificationSeverity severity = NotificationSeverity.Info)
{
await _notificationPublisher.PublishAsync(
"App.SimpleMessage",
new MessageNotificationData(message),
severity: severity,
userIds: new[] { userId } );
}
}
I can see messages in debugger console in the browser:
abp.js:285 DEBUG: abp.js:285 Connected to SignalR server! abp.js:285 DEBUG: abp.js:285 Registered to the SignalR server!
However, the event in header.js is never fired:
abp.event.on('abp.notifications.received', function (userNotification) {
console.log("notification!", userNotification);
});
Any help would be greatly appreciated.
Hi,
Could someone please assist in my need to create a route that will handle all my short links without breaking the Signal R / Angular JS front end architecture?
What I need is e.g. host/shortlink1 should redirect to host/applicaiton#/listing/123
The /application#/object is be pre-defined or determined.
Good day,
I would like to inject a service to HangFire job. How to properly do it ? I have following code: Global.asax:
_container = new WindsorContainer();
_container.Register(Castle.MicroKernel.Registration.Component.For<IListingImageAppService().ImplementedBy(typeof(ListingImageAppService)).LifestyleSingleton());
JobActivator.Current = new WindsorJobActivator(_container.Kernel);
My JobBundle config:
WindsorContainer con = new WindsorContainer();
ImagesImportJob job = new ImagesImportJob(con.Resolve<ListingImageAppService>());
RecurringJob.AddOrUpdate("JobId", () => job.ImportImages(), Cron.Daily);
And my HangFire Job:
public class ImagesImportJob
{
private readonly ListingImageAppService _srv;
public ImagesImportJob(ListingImageAppService srv) { _srv = srv; }
public void ImportImages()
{
///
}
}
Good day,
I would like to tie ApplicationLanguage with other entities.
For example, I want to create many-to-many relatioship between ApplicationLanguage and my custom Region class.
The problem is that ApplicationLanguage class in a separate solution and, therefore I can not modify it.
Is there a way to add navigation property to the ApplicationLanguage class ?
Pavel