ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Reading Records from a file using FileRead Node

Post new topic  Reply to topic Goto page 1, 2  Next
 Reading Records from a file using FileRead Node « View previous topic :: View next topic » 
Author Message
j1
PostPosted: Wed Dec 02, 2015 3:50 pm    Post subject: Reading Records from a file using FileRead Node Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

Hi,

I have a requirement to read records from a file as they are being appended on an ongoing basis. It looks like this kind of use case may be possible using the FileRead Node but the documentation is not clear how the FileRead node could be made to do this periodically to read off new records appended to a file. Would using a Timer node with a FileRead node be the answer?

Thanks in advance
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Dec 02, 2015 11:10 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

That is not a requirement. That is a possible (and weak) design.

Ask them to use MQ messages if possible.
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.


Last edited by zpat on Mon Apr 25, 2016 12:10 am; edited 1 time in total
Back to top
View user's profile Send private message
timber
PostPosted: Thu Dec 03, 2015 2:21 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Quote:
I have a requirement to read records from a file as they are being appended on an ongoing basis.
What happens if the FileRead node tries to read the file before the 'append' has completed?
Quote:
Would using a Timer node with a FileRead node be the answer?
Only if there is no other design that can possibly work, and my question above has been explored carefully.

Why does it have to be done this way? Can the application that appends to this file write to a new file instead?
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Dec 03, 2015 3:30 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Files are transactionally unsafe.


Even if the developers have not heard of MQ, have they heard of JMS?
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.


Last edited by zpat on Mon Apr 25, 2016 12:09 am; edited 1 time in total
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Dec 03, 2015 5:26 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

zpat wrote:
Can the application stop living in the 1970's and use messaging instead of files for transactions?


If the system is in South Asia then it seems that 'Files Rulez Ok'
We had to implement a system where it seemed that every interface was FTP. One of the connections was even going to be picked up by an application and sent on by MQ!

My thoughts at the time were:
Find a brick wall and bassh you head until you can see that it makes perfect sense.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
timber
PostPosted: Thu Dec 03, 2015 7:29 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

For whatever reasons, file-based integration is alive and well in most parts of the world, including the USA and the UK. I agree that MQ is superior, but getting an entire organisation to move away from file-based integration is a difficult sell.
The second-best isolutiuon s to get people to realise that FTP is best done using a managed file transfer tool like MQFT...which also provides a migration path towards MQ messaging in the medium term.
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Dec 03, 2015 7:39 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

No-one is suggesting removing all files, but each time some complex solution involving files is proposed - it needs to be challenged, otherwise it could get out of control with layer on layer of workarounds that have transactional integrity gaps
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.


Last edited by zpat on Mon Apr 25, 2016 12:08 am; edited 1 time in total
Back to top
View user's profile Send private message
j1
PostPosted: Fri Dec 04, 2015 3:17 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

The problem here is that the messages are in MQ to begin with, as PCF formatted messages. Not being much of a C programmer or familiar with PCF, I could only hack some sample code to write the PCF messages to a file..and that's where the problem lies,... to get them back onto a queue as XML messages (not PCF). Was hoping IIB could come to the rescue here
Back to top
View user's profile Send private message
j1
PostPosted: Fri Dec 04, 2015 3:21 am    Post subject: Reply with quote

Centurion

Joined: 23 Jun 2003
Posts: 139

besides, as timber points out, this would not be a too uncommon use case - having to read messages off a file that's being written to and put them to a queue. I was thinking of using something like 'Q' tool or qload but all of those have a problem maintaining an offset (to read only newly appended messages)
Back to top
View user's profile Send private message
timber
PostPosted: Fri Dec 04, 2015 5:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Quote:
Not being much of a C programmer or familiar with PCF, I could only hack some sample code to write the PCF messages to a file
That doesn't make a lot of sense. Why can you not write the messages to an MQ queue?
Quote:
besides, as timber points out, this would not be a too uncommon use case - having to read messages off a file that's being written to and put them to a queue.
I actually said 'file-based integration is alive and well in most parts of the world'. I don't see how you can interpret that to mean what you said. Please don't misquote me in order to support your (decidedly shaky) position.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri Dec 04, 2015 5:22 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

j1 wrote:
The problem here is that the messages are in MQ to begin with, as PCF formatted messages. Not being much of a C programmer or familiar with PCF, I could only hack some sample code to write the PCF messages to a file..and that's where the problem lies,... to get them back onto a queue as XML messages (not PCF). Was hoping IIB could come to the rescue here


Why can't you have IIB read the messages off the initial queue and dump your hacked together C code altogether?

Then your flow would be dealing with MQ messages in PCF format and simply turning them into XML messages on the new queue. No messy file interactions needed.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 04, 2015 5:26 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

j1 wrote:
The problem here is that the messages are in MQ to begin with, as PCF formatted messages. Not being much of a C programmer or familiar with PCF, I could only hack some sample code to write the PCF messages to a file..and that's where the problem lies,... to get them back onto a queue as XML messages (not PCF). Was hoping IIB could come to the rescue here

First of all you show a very poor understanding of the problem.
If your spec is to translate the PCF message (presumably a response to a PCF enquiry) into an XML message than what does a file have to do in the middle???
pcf message and understand what your spec is calling for...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Fri Dec 04, 2015 5:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

j1 wrote:
The problem here is that the messages are in MQ to begin with, as PCF formatted messages. Not being much of a C programmer or familiar with PCF, I could only hack some sample code to write the PCF messages to a file..and that's where the problem lies,... to get them back onto a queue as XML messages (not PCF). Was hoping IIB could come to the rescue here


This is insane.

If you want IIB to come to the rescue, get IIB to read the PCF messages from the original queue and write XML to the target; if you want to hack some code (your words not mine), leave IIB out of it and keep hacking some more code to write to a queue. It's not hard - it's the code you've already hacked but running the other way.

Do not do both. This just makes it worse.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 04, 2015 6:17 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So the messages start as PCF messages on a queue.

You then write them to a file, and want to use IIB to read them from a file and then turn them into XML?

No. Don't do that.

Read the messages directly using an MQInput node. Use the MQ Java classes in a JCN to parse and work with the PCF messages. Use the IIB Java classes to create an XMLNSC output tree.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Dec 04, 2015 8:28 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

There is even a post in this forum that described how to create a PCF Message using ESQL and process the response.

Take a look at it and see if that will help you eliminate files from your solution entirely.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Reading Records from a file using FileRead Node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.