Activities of "alexander.nikonov"

I understand that it has nothing to do with RabbitMQ. I just don't know what is the simplest way to invoke some action in HttpApi.Host project, if it's not an API call initiated action (as in scenario 1)

You got me wrong. Event received from another app via RabbitMQ. But it's received in THIS app. I just need a simple scenario to imitate this. Do I need RabbitMQ at all or can reproduce it in other way? After all, I can even send the message from THIS app too... I just didn't want to install RabbitMQ, hope could do it in an easier way.

I still cannot wrap my head around it - how to reproduce this scenario in the test project...

One part is clear:

But another part - not. In the original project, RabbitMq event is received from another running app. Receiver of this event resides in HttpApi.Host project and tries to update the cache. Could you please suggest me a simple example - how to emulate this in the test project? I don't want to make it too complex. Thanks.

Alas, I cannot do that. I have a test project which used to work a while ago. Now it does not - I don't remember why, need to start bugfixing it. I can see there is no Test DB anymore. I run Migration project, but it fails...

Seems like I need to create a brand-new test project. This does not work. I need to recall how to do that.. Probably via AbpSuite...

I thought I have dealt with #1, but now all of the sudden it does not work again!

The framework will register all IDistributedCache as Singleton. You dont need to register it again.

Thank you, I've removed excessive registrations.

Memory cache cannot cross project/application process

This is an important note. But I want to clarify. Let's say I have IDistributedCache<CacheItem> and CacheManager, which is also registered as a singleton. CacheManager reads and updates the CacheItem. Both classes - CacheItem and CacheManager reside in Application tier. So when I use CacheManager DI from Application tier - all cache operations work predictable. However, when I invoke CacheManager DI to update the cache from HttpApi.Host tier - I have the feeling that it updates a different cache! So - are you implying that it's a normal behavior and these are in fact two different caches - on two different solution tiers despite the fact that HttpApi.Host layer has project reference to Application?

Sorry - I am lack of time for building the scenario in a test project, considering this described issue is not the only weird thing, there are more coming (this all is related):

  1. I have managed to overcome the described problem: instead of retrieving cockpitCacheManager instance using _serviceProvider.GetRequiredService<CockpitCacheManager>() inside MyRabbitMqReceiver I retrieved it using _serviceProvider.GetRequiredService<IHost>().Services.GetRequiredService<CockpitCacheManager>(); - this way the cache item was not null anymore; to me it looked like using a common IServiceProvider for both singletons;

  2. however updating the cache still causes me the troubles - I don't know why, just thinking aloud: probably it also has something to do with DI...

What is a proper way to update the cache? Am I missing something important here or doing it in a wrong way? Trying to keep the code simple and schematic as much as possible (as always, I am not allowed to share the full code):

    public class CockpitCacheManager
    {
        ...
        public async Task&lt;bool&gt; UpdateAndNotifyClientsAsync(CockpitCacheUpdateDto input)
        {
            using (await _cockpitCacheUpdateSemaphore.LockAsync())
            {
                (var cockpitCacheItem, var isCacheHit) = await GetItemAsync(isForceRefresh); //reading the cache using GetOrAddAsync under the hood

                if (cockpitCacheItem == null)
                {
                    return false;
                }

                using (var scope = _host.Services.CreateScope()) //should the scope look like this?
                {
                    var caseRepository = scope.ServiceProvider.GetRequiredService&lt;ICaseRepository&gt;();
                    ...
                    //updating cache item:
                    if (value1 != null) //input parameter 1
                    {
                        cockpitCacheItem.Field1 = value1;
                    }
                    ...
                    if (valueN != null) //input parameter N
                    {
                        cockpitCacheItem.FieldN = valueN;
                    }
                    ...
                    if (cacheChanged) //old and new cache hash is calculated
                    {
                        await _cockpitCache.SetAsync(CockpitCacheItem.Key, cockpitCacheItem);
                    }
                }
            }
        }
    }        

Not sure. Probably it's related. You might close this one. But if that ticket is resolved, however this problem does not go away - I will reopen this ticket.

The log has been already attached (Google Drive link above).

Hi. The project is a customized version of ABP project. I don't think it would be possible to do what you offer. Neither I can share the source code - by sending it or demonstrating the screen. Could you please at least make some guesses what could go wrong looking at the attached logs and my comments? Thanks.

Not resolved. Reopening.

Showing 51 to 60 of 276 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30